source: trunk/gui/vizservers/nanovis/Volume.h @ 416

Last change on this file since 416 was 416, checked in by qiaow, 19 years ago

More interface functions for manipulating cutplanes. Now multiple volumes with multiple cutplanes working!!

File size: 2.2 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 * Volume.h: 3d volume class
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_H_
17#define _VOLUME_H_
18
19#include <vector>
20
21#include "define.h"
22#include "Texture3D.h"
23#include "Vector3.h"
24
25using namespace std;
26
27struct CutPlane{
28  int orient;   //orientation - 1: xy slice, 2: yz slice, 3: xz slice
29  float offset; //normalized offset [0,1] in the volume
30  bool enabled;
31
32  CutPlane(int _orient, float _offset):
33        orient(_orient),
34        offset(_offset),
35        enabled(true){}
36};
37
38
39class Volume{
40       
41private:
42        vector <CutPlane> plane; //cut planes
43
44public:
45        Vector3 location;
46
47        bool enabled;
48
49        int width;
50        int height;
51        int depth;
52
53        float aspect_ratio_width;
54        float aspect_ratio_height;
55        float aspect_ratio_depth;
56
57        NVISdatatype type;
58        NVISinterptype interp_type;
59        int n_components;
60
61        Texture3D* tex; //OpenGL texture storing the volume
62        NVISid id;   //OpenGL textue identifier (==tex->id)
63
64        Volume(float x, float y, float z,
65                        int width, int height, int depth,
66                        NVISdatatype type, NVISinterptype interp,
67                        int n_component, float* data);
68        ~Volume();
69       
70        void enable(); //VolumeRenderer will render an enabled volume and its cutplanes
71        void disable();
72        void move(Vector3 _loc);
73        bool is_enabled();
74        Vector3* get_location();
75
76        //methods related to cutplanes
77        int add_cutplane(int _orientation, float _location); //add a plane and returns its index
78        void enable_cutplane(int index);
79        void disable_cutplane(int index);
80        void move_cutplane(int index, float _location);
81        CutPlane* get_cutplane(int index);
82        int get_cutplane_count();       //returns the number of cutplanes in the volume
83        bool cutplane_is_enabled(int index);    //check if a cutplane is enabled
84
85};
86
87#endif
Note: See TracBrowser for help on using the repository browser.