HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GR_VolumeGL3.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GR_VolumeGL3.h ( GR Library, C++)
7  *
8  * COMMENTS:
9  * Volume rendering in GL3.
10  */
11 #ifndef GR_VolumeGL3_h
12 #define GR_VolumeGL3_h
13 
14 class UT_Color;
15 class RE_OGLTexture;
16 class GU_PrimVolume;
17 struct gr_VolumeAngleVector;
18 class gr_GLViewAlignedSlice;
19 
20 #include "GR_GeoRender.h"
21 
22 #include <RE/RE_Geometry.h>
23 #include <UT/UT_BoundingBox.h>
24 #include <UT/UT_Lock.h>
25 #include <UT/UT_ValArray.h>
26 #include <UT/UT_Vector3.h>
27 #include <GU/GU_Detail.h>
28 #include <GEO/GEO_PrimVolume.h>
29 
30 class GR_VolumeGL3 : public GR_GeoRender
31 {
32 public:
34  virtual ~GR_VolumeGL3();
35 
36  virtual const char *className() const { return "GR_VolumeGL3"; }
37 
38  virtual void update(RE_Render *r,
39  const GT_PrimitiveHandle &primh,
40  const GR_UpdateParms &p,
41  const char *cache_name);
42 
43  virtual void viewUpdate(RE_Render *r,
44  const GR_DisplayOption &opts,
45  const char *cache_name,
46  RE_CacheVersion geo_version,
47  RE_CacheVersion select_version);
48  virtual void draw(RE_Render *r,
51  GR_DrawParms dp);
52 
53  void setTexture(const RE_TextureHolder &tex)
54  {
55  myVolumeTexture = tex;
56  }
57 
58  void updateTexture(const RE_TextureHolder &tex);
59  void clearTexture();
60 
61  static void cleanupSlices();
62 
63  virtual exint getNumGLPrimitives() const;
64 
65 private:
66  bool updateViewAligned(RE_Render *r,
67  const GR_DisplayOption &drawOpt);
68  static void sliceCube(void *data, int idx, int num, UT_Lock &lock);
69  static void barycenterTriangulateConvexPoly(const UT_Vector3Array &points,
70  float tolerance2,
71  UT_Vector3Array *out_points,
72  int total_depth=1, int d=0);
73  static void sortPolygonCCW(gr_VolumeAngleVector *points, int n);
74  static UT_Vector3 pointAverage(const UT_Vector3Array &points);
75  static void triangulate(const UT_Vector3Array &points,
76  float tolerance2,
77  UT_Vector3Array *out_points,
78  int total_depth=-1, int d=0);
79 
80  bool instanceSlices(RE_Render *r,
81  UT_Matrix4D &view, UT_Matrix4D &object,
82  fpreal zinc);
83  void drawSlices(RE_Render *r,
85  GR_RenderMode render_mode,
86  const GR_DisplayOption *opt);
87  void clearSlices();
88 
89  GU_Detail myBox;
90  GEO_PrimVolumeXform myVolumeSpace;
91  UT_Vector3I myVolumeRes;
92  UT_BoundingBox myVolumeBounds;
93  RE_TextureHolder myVolumeTexture;
94  fpreal32 myDepthStep;
95  GR_RenderMode myDrawMode;
96  UT_Matrix4DArray myInstanceTransforms;
97 
98  static int theVolumePassID;
99 
100  UT_ValArray<gr_GLViewAlignedSlice *> myGLVolumeSlices;
101  };
102 
103 #endif
virtual exint getNumGLPrimitives() const
GLbitfield flags
Definition: glcorearb.h:1595
virtual void draw(RE_Render *r, GR_RenderMode mode, GR_RenderFlags flags, GR_DrawParms dp)
Normal drawing method. Only issue rendering commands.
virtual const char * className() const
Definition: GR_VolumeGL3.h:36
3D Vector class.
virtual void update(RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p, const char *cache_name)
set of parameters sent to GR_Primitive::update()
virtual void viewUpdate(RE_Render *r, const GR_DisplayOption &opts, const char *cache_name, RE_CacheVersion geo_version, RE_CacheVersion select_version)
GLdouble n
Definition: glcorearb.h:2007
GR_VolumeGL3(GR_Primitive *prim)
GR_RenderMode
Definition: GR_Defines.h:42
int64 exint
Definition: SYS_Types.h:109
void setTexture(const RE_TextureHolder &tex)
Definition: GR_VolumeGL3.h:53
GLboolean * data
Definition: glcorearb.h:130
GR_RenderFlags
Definition: GR_Defines.h:77
GLenum mode
Definition: glcorearb.h:98
double fpreal
Definition: SYS_Types.h:263
static void cleanupSlices()
virtual ~GR_VolumeGL3()
png_infop png_uint_32 int num
Definition: png.h:2158
Simple class for a mutli-integer cache tag.
void clearTexture()
GLboolean r
Definition: glcorearb.h:1221
void updateTexture(const RE_TextureHolder &tex)
float fpreal32
Definition: SYS_Types.h:184