HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_PolySurface.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_PrimPolySurface.h ( GR Library, C++)
7  *
8  * COMMENTS:
9  * Generic base class for polygon meshes and soups for all GL renderers
10  */
11 #ifndef GR_PrimPolySurface_h
12 #define GR_PrimPolySurface_h
13 
14 #include "GR_Defines.h"
15 #include "GR_GeoRender.h"
16 
17 #include <GT/GT_Primitive.h>
18 
19 #include <UT/UT_NonCopyable.h>
20 #include <UT/UT_Vector3.h>
21 
22 class GT_DataArray;
23 class GT_PrimPolygonMesh;
24 
26 {
27 public:
28  static GR_PolySurface *create(GR_Primitive *parent, bool convex);
29 
31  bool needs_convexing);
32  virtual ~GR_PolySurface();
33 
34  virtual const char *className() const { return "GR_PolySurface"; }
35 
36  virtual void update(RE_Render *r,
37  const GT_PrimitiveHandle &primh,
38  const GR_UpdateParms &p,
39  const char *cache_name);
40 
41  virtual bool hasTransparency() const
42  { return (myHasAlpha || myHasTransparentMaterial); }
43 
44  GT_PrimitiveHandle getConvexGeometry() { return myConvexGeo; }
45 
46  virtual exint getNumGLPrimitives() const;
47 
48 protected:
49  virtual void retireGeometry();
50 
51  virtual int buildVertexAttributes(RE_Render *r,
52  const GT_PrimPolygonMesh *pmesh,
53  const GR_UpdateParms &p,
54  bool needs_normal,
55  bool needs_uv,
56  bool new_geo,
57  bool &vertex_promote) = 0;
58 
59  // build based on a Material Atlas
60  virtual void buildConnectivity(RE_Render *r,
61  const GT_PrimPolygonMesh *pmesh,
62  const char *cache_name,
63  RE_CacheVersion geo_version,
64  const RE_MaterialAtlas &mats,
65  int npoints,
66  bool wireframe,
67  bool vertex_promote,
68  bool convexed) = 0;
69 
70  virtual GT_PrimitiveHandle convexSurface(const GT_PrimPolygonMesh *pmesh)=0;
71 
72  GT_PrimitiveHandle convexWithEdgeInfo(const GT_PrimPolygonMesh *pmesh,
75  GT_DataArrayHandle &vch);
76 
77  GT_DataArrayHandle getPointNormals() { return myAutoGenPointN; }
78  void freePointNormals();
79 
80  virtual void updateBoneTransforms(RE_Render *r,
81  const GT_DataArrayHandle &a) = 0;
82 
83  virtual int numMaterials() const = 0;
84 
85  bool myHasAlpha;
88 
89 private:
90  GT_PrimitiveHandle convexMesh(const GT_PrimPolygonMesh *pmesh,
91  const GR_UpdateParms &p,
92  bool &convexed,
93  bool prev_convex_state);
94 
95  void cacheConvexMesh(const GT_PrimitiveHandle &convexed,
96  const GT_PrimPolygonMesh *original);
97  void clearCachedConvexMesh();
98 
99  bool myNeedsConvex;
100  GT_PrimitiveHandle myOriginalGeo;
101  GT_PrimitiveHandle myConvexGeo;
102  GT_DataArrayHandle myAutoGenPointN;
103  int64 myTopVersion;
104  int64 myMatIDVersion;
105 
106  GT_DataArrayHandle myConvexUniformIndirect;
107  GT_DataArrayHandle myConvexVertexIndirect;
108  GT_DataArrayHandle myConvexVertexList;
109  GT_DataArrayHandle myConvexPrimInfo;
110  GT_DataArrayHandle myConvexVertInfo;
111  UT_Pair<int64, int64> myConvexVersion;
112 };
113 #endif
114 
A mesh of polygons.
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
GT_API const UT_StringHolder cache_name
GT_PrimitiveHandle getConvexGeometry()
virtual exint getNumGLPrimitives() const =0
set of parameters sent to GR_Primitive::update()
long long int64
Definition: SYS_Types.h:111
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:39
int64 exint
Definition: SYS_Types.h:120
virtual bool hasTransparency() const
returns true if this drawable renders some transparent elements
#define GR_API
Definition: GR_API.h:10
bool myHasTransparentMaterial
GT_DataArrayHandle getPointNormals()
virtual const char * className() const
virtual void retireGeometry()
virtual void update(RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p, const char *cache_name)=0
GLfloat GLfloat p
Definition: glew.h:16321
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
Simple class for a mutli-integer cache tag.