- Timestamp:
- Apr 3, 2012 3:51:13 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/packages/vizservers/nanovis/PlaneRenderer.h
r953 r2936 1 1 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 2 /* 3 3 * ---------------------------------------------------------------------- … … 14 14 * ====================================================================== 15 15 */ 16 #ifndef PLANE_RENDERER_H 17 #define PLANE_RENDERER_H 16 18 17 #ifndef _PLANE_RENDERER_H_18 #define _PLANE_RENDERER_H_19 20 #include <GL/glew.h>21 #include <Cg/cgGL.h>22 #include <GL/glut.h>23 19 #include <math.h> 24 20 #include <stdio.h> 25 21 #include <assert.h> 26 22 #include <float.h> 23 27 24 #include <vector> 28 25 29 #include "define.h" 30 #include "global.h" 26 #include <GL/glew.h> 27 #include <Cg/cgGL.h> 28 29 #include "NvColorTableShader.h" 31 30 #include "TransferFunction.h" 32 31 #include "Texture2D.h" 33 32 34 using namespace std; 33 class PlaneRenderer 34 { 35 public: 36 PlaneRenderer(int width, int height); 35 37 36 class PlaneRenderer{ 38 ~PlaneRenderer(); 39 40 /// Add a plane and its transfer function. 41 int addPlane(Texture2D *p, TransferFunction *tf); 42 43 void removePlane(int index); 44 45 /// Set the active plane to be rendered 46 void setActivePlane(int index); 47 48 /// Change the rendering size 49 void setScreenSize(int w, int h); 50 51 void render(); 37 52 38 53 private: 39 vector <Texture2D*> plane; // Array of volumes40 vector <TransferFunction*> tf; //Array of corresponding transfer functions41 int active_plane; //The active plane, only one is rendered42 int n_planes;54 std::vector<Texture2D *> _plane; ///< Array of images 55 std::vector<TransferFunction *> _tf; ///< Array of corresponding transfer functions 56 int _activePlane; ///< The active plane, only one is rendered 57 int _numPlanes; 43 58 44 int render_width; //render size45 int render_height;59 int _renderWidth; 60 int _renderHeight; 46 61 47 //cg related 48 CGcontext g_context; // The Nvidia cg context 49 CGprogram m_fprog; 50 CGparameter m_data_param; 51 CGparameter m_tf_param; 52 CGparameter m_render_param; 53 54 void init_shaders(); 55 void activate_shader(int plane_index); 56 void deactivate_shader(); 57 58 public: 59 PlaneRenderer(CGcontext _context, int width, int height); 60 ~PlaneRenderer(); 61 62 int add_plane(Texture2D* _p, TransferFunction* _tf); 63 // Add a plane and its transfer function. We require a transfer function 64 // when a plane is added. 65 void remove_plane(int index); 66 void set_active_plane(int index); //set the active plane to be rendered 67 void set_screen_size(int w, int h); //change the rendering size 68 void render(); 62 NvColorTableShader *_shader; 69 63 }; 70 64
Note: See TracChangeset
for help on using the changeset viewer.