HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_PrimVolume.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: GT_PrimVolume.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 #ifndef GT_PrimVolume_h
11 #define GT_PrimVolume_h
12 
13 #include "GT_API.h"
14 #include "GT_Primitive.h"
15 #include "GT_GEOPrimCollect.h"
16 #include "GT_AttributeList.h"
17 #include <GEO/GEO_PrimVolume.h>
18 #include <GU/GU_DetailHandle.h>
19 #include <UT/UT_Vector3.h>
20 #include <UT/UT_Vector4.h>
21 #include <UT/UT_VoxelArray.h>
22 
23 
24 class GEO_Primitive;
25 class GU_PrimVolumeCache;
27 
29 {
30 public:
32  const GEO_Primitive *prim,
33  const GT_DataArrayHandle &mat_id);
35  virtual ~GT_PrimVolume();
36 
37  virtual int getPrimitiveType() const { return GT_PRIM_VOXEL_VOLUME; }
38 
39  virtual const char *className() const { return "GT_PrimVolume"; }
40 
41  virtual void enlargeBounds(UT_BoundingBox boxes[],
42  int nsegments) const;
43  virtual int getMotionSegments() const { return 1; }
44  virtual int64 getMemoryUsage() const;
46  { return new GT_PrimVolume(*this); }
47 
48  virtual bool refine(GT_Refine &refiner,
49  const GT_RefineParms *parms) const;
50  bool refineHeightField(GT_Refine &refiner,
51  const GT_RefineParms *parms) const;
52 
53  // Isosurface
54  bool isIsosurface() const;
55  GT_PrimitiveHandle buildIsosurface(const GT_RefineParms &p,
56  bool as_points) const;
57  GU_ConstDetailHandle getIsosurfaceDetail() const;
58  UT_Vector3 getIsoCd() const;
59 
60  // Height fields
61  bool isHeightField() const;
62  GT_PrimitiveHandle buildHeightField(const GT_RefineParms &p) const;
63  GT_PrimitiveHandle buildHeightMesh(const GT_RefineParms &p,
64  UT_Vector2i &map_res) const;
66  {
70  };
71  gt_BlendMask blendMaskState(int index) const;
72 
73  // 2D/3D volume
74  bool isSmokeVolume() const;
75  bool is3DVolume() const;
76  GEO_PrimVolumeXform getVolumeSpace() const;
77 
78  UT_Vector3I getRes() const;
79 
80  void get2DBounds(UT_Vector3F &p0, UT_Vector3F &p1,
81  UT_Vector3F &p2, UT_Vector3F &p3) const;
82 
83  const UT_VoxelArray<UT_Vector4> *getVoxels(const GU_PrimVolumeCacheParms &p,
84  int64 version[2]) const;
85 
86  GEO_PrimVolumeXform getVolumeTransform() const;
87  GEO_PrimVolumeXform getVolumeIndexTransform() const;
88  GT_PrimitiveHandle getPointPrimitive();
90  { return getPrimitive(); }
91 
93  { return myVolumeAttributes.entries(); }
95  { return myVolumeAttributes(i); }
97  { myVolumeAttributes.append(prim); }
98 
100  { return myUniformList; }
101  virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
102  const GT_RefineParms &refine);
103 
104  bool getFlip() const { return myFlip; }
105  bool isVolumeReduced() const { return myVolumeReduced; }
106 
107 private:
108  const GEO_Primitive *getPrimitive() const;
109 
110  GU_PrimVolumeCache *myCache;
111  GT_AttributeListHandle myUniformList;
112 
113  // Is either VDB or Volume.
114  GU_ConstDetailHandle myDetail;
115  GA_Offset myPrimOffset;
116  UT_Array<const GEO_Primitive *> myVolumeAttributes;
117  mutable int64 myCacheVersion[2];
118  mutable bool myIsosurfaceFlag;
119  mutable bool mySmokeVolumeFlag;
120  mutable bool myHeightFieldFlag;
121  mutable bool myIs3DVolume;
122  mutable bool myFlip;
123  mutable GT_PrimitiveHandle myMesh;
124  mutable UT_Vector2i myMeshSize;
125  mutable UT_Vector3F myMeshP0;
126  mutable UT_Vector3F myMeshP1;
127  mutable UT_Vector3F myMeshP2;
128  mutable UT_Vector3F myMeshP3;
129  mutable UT_Array<gt_BlendMask> myBlendMaskState;
130  mutable bool myVolumeReduced;
131  static int64 theMeshDataID;
132  static int64 theMeshTopID;
133 };
134 
135 /// Trivial collector class for Volume - 1 GT_PrimVolume per Volume primitive
136 /// with the visualization set to 'volume'.
138 {
139 public:
142 
143  virtual GT_GEOPrimCollectData *
144  beginCollecting(const GT_GEODetailListHandle &geometry,
145  const GT_RefineParms *parms) const;
146 
148  const GEO_Primitive *const* prim_list,
149  int,
150  GT_GEOPrimCollectData *) const;
151 
152  virtual GT_PrimitiveHandle
153  endCollecting(const GT_GEODetailListHandle &geometry,
154  GT_GEOPrimCollectData *data) const;
155 };
156 
157 #endif
virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl, const GT_RefineParms &parms)
update any cached data for geometry and its attributes
const GEO_Primitive * getVolumeAttribute(exint i) const
Definition: GT_PrimVolume.h:94
virtual bool refine(GT_Refine &refiner, const GT_RefineParms *parms=NULL) const
virtual GT_GEOPrimCollectData * beginCollecting(const GT_GEODetailListHandle &geometry, const GT_RefineParms *parms) const
bool isVolumeReduced() const
virtual int getPrimitiveType() const
Definition: GT_PrimVolume.h:37
#define GT_API
Definition: GT_API.h:11
bool getFlip() const
virtual const char * className() const
Definition: GT_PrimVolume.h:39
virtual ~GT_GEOPrimCollectVolume()
virtual const GT_AttributeListHandle & getUniformAttributes() const
Definition: GT_PrimVolume.h:99
3D Vector class.
png_uint_32 i
Definition: png.h:2877
Collection data container.
GA_Size GA_Offset
Definition: GA_Types.h:617
long long int64
Definition: SYS_Types.h:107
virtual GT_PrimitiveHandle endCollecting(const GT_GEODetailListHandle &geometry, GT_GEOPrimCollectData *data) const
int64 exint
Definition: SYS_Types.h:116
virtual GT_PrimitiveHandle collect(const GT_GEODetailListHandle &geometry, const GEO_Primitive *const *prim_list, int nsegments, GT_GEOPrimCollectData *data) const =0
GLboolean * data
Definition: glcorearb.h:130
void appendVolumeAttribute(const GEO_Primitive *prim)
Definition: GT_PrimVolume.h:96
The base class for all GT primitive types.
Definition: GT_Primitive.h:43
virtual int64 getMemoryUsage() const =0
virtual int getMotionSegments() const
Definition: GT_PrimVolume.h:43
GT_API const UT_StringHolder version
Processes primitives generated by refinement process.
Definition: GT_Refine.h:20
exint getNumVolumeAttributes() const
Definition: GT_PrimVolume.h:92
GLuint index
Definition: glcorearb.h:785
virtual GT_PrimitiveHandle doSoftCopy() const
Definition: GT_PrimVolume.h:45
UT_SharedPtr< GT_GEODetailList > GT_GEODetailListHandle
virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const =0
const GEO_Primitive * getGeoPrimitive() const
Definition: GT_PrimVolume.h:89
GLenum src
Definition: glcorearb.h:1792