source: trunk/gui/vizservers/nanovis/VolumeRenderer.h @ 410

Last change on this file since 410 was 407, checked in by qiaow, 18 years ago

Added 3 cut planes for each volume object

File size: 2.6 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 * VolumeRenderer.h : VolumeRenderer class for volume 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 _VOLUME_RENDERER_H_
17#define _VOLUME_RENDERER_H_
18
19#include <GL/glew.h>
20#include <Cg/cgGL.h>
21#include <math.h>
22#include <stdio.h>
23#include <assert.h>
24#include <float.h>
25#include <vector>
26
27#include "define.h"
28#include "global.h"
29#include "Camera.h"
30#include "ConvexPolygon.h"
31#include "TransferFunction.h"
32#include "Mat4x4.h"
33#include "Volume.h"
34#include "PerfQuery.h"
35
36using namespace std;
37
38class VolumeRenderer{
39
40private:
41  Camera* cam;
42  vector <Volume*> volume;      //array of volumes
43  vector <TransferFunction*> tf;//array of corresponding transfer functions
44  vector <int> slice;           //array of corresponding number of slices
45  vector <bool> render_bit;     //bits marking which volume(s) to render
46  int n_volumes;
47
48  //shading parameters
49  float live_diffuse;
50  float live_specular;
51
52  //cg related
53  CGcontext g_context;          //the Nvidia cg context
54  CGprogram m_one_volume_fprog;
55  CGparameter m_vol_one_volume_param;
56  CGparameter m_tf_one_volume_param;
57  CGparameter m_mvi_one_volume_param;
58  CGparameter m_mv_one_volume_param;
59  CGparameter m_render_param_one_volume_param;
60
61  CGprogram m_vert_std_vprog;
62  CGparameter m_mvp_vert_std_param;
63  CGparameter m_mvi_vert_std_param;
64
65  void activate_one_volume_shader(int volume_index, int n_actual_slices, float opacity_scale);
66  void deactivate_one_volume_shader();
67
68  //draw bounding box
69  void draw_bounding_box(float x0, float y0, float z0,
70                        float x1, float y1, float z1,
71                        float r, float g, float b, float line_width);
72
73  void get_near_far_z(Mat4x4 mv, double &zNear, double &zFar);
74
75public:
76  VolumeRenderer();
77  VolumeRenderer(Camera* cam, Volume* _vol, TransferFunction* _tf, CGcontext _context);
78  ~VolumeRenderer();
79
80  void add_volume(Volume* _vol, TransferFunction* _tf, int _slice);
81                                                //add a volume and its transfer function
82                                                //we require a transfer function when a
83                                                //volume is added.
84  void render(int volume_index);
85  void set_specular(float val);
86  void set_diffuse(float val);
87};
88
89#endif
Note: See TracBrowser for help on using the repository browser.