source: trunk/vizservers/nanovis/PlaneRenderer.h @ 829

Last change on this file since 829 was 455, checked in by mmc, 18 years ago

Added a new "legend" command, which can be used to request the
legend strip for a transfer function.

File size: 2.0 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 * PlaneRenderer.h : PlaneRenderer class for 2D visualization
4 *
5 * ======================================================================
6 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
7 *           Purdue Rendering and Perceptualization Lab (PURPL)
8 *
9 *  Copyright (c) 2004-2006  Purdue Research Foundation
10 *
11 *  See the file "license.terms" for information on usage and
12 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 * ======================================================================
14 */
15
16#ifndef _PLANE_RENDERER_H_
17#define _PLANE_RENDERER_H_
18
19#include <GL/glew.h>
20#include <Cg/cgGL.h>
21#include <GL/glut.h>
22#include <math.h>
23#include <stdio.h>
24#include <assert.h>
25#include <float.h>
26#include <vector>
27
28#include "define.h"
29#include "global.h"
30#include "TransferFunction.h"
31#include "Texture2D.h"
32
33using namespace std;
34
35class PlaneRenderer{
36
37private:
38  vector <Texture2D*> plane;     //array of volumes
39  vector <TransferFunction*> tf; //array of corresponding transfer functions
40  int active_plane;              //the active plane, only one is rendered
41  int n_planes;
42
43  int render_width;     //render size
44  int render_height;   
45
46  //cg related
47  CGcontext g_context;          //the Nvidia cg context
48  CGprogram m_fprog;
49  CGparameter m_data_param;
50  CGparameter m_tf_param;
51  CGparameter m_render_param;
52
53  void init_shaders();
54  void activate_shader(int plane_index);
55  void deactivate_shader();
56
57public:
58  PlaneRenderer(CGcontext _context, int width, int height);
59  ~PlaneRenderer();
60
61  int add_plane(Texture2D* _p, TransferFunction* _tf);
62                                                //add a plane and its transfer function
63                                                //we require a transfer function when a
64                                                //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();
69};
70
71#endif
Note: See TracBrowser for help on using the repository browser.