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 { return myHasAlpha; }
42 
43  GT_PrimitiveHandle getConvexGeometry() { return myConvexGeo; }
44 
45  virtual exint getNumGLPrimitives() const;
46 
47 protected:
48  virtual void retireGeometry();
49 
50  virtual int buildVertexAttributes(RE_Render *r,
51  const GT_PrimPolygonMesh *pmesh,
52  const GR_UpdateParms &p,
53  bool needs_normal,
54  bool needs_uv,
55  bool new_geo,
56  bool &vertex_promote) = 0;
57 
58  // build based on a Material Atlas
59  virtual void buildConnectivity(RE_Render *r,
60  const GT_PrimPolygonMesh *pmesh,
61  const char *cache_name,
62  RE_CacheVersion geo_version,
63  const RE_MaterialAtlas &mats,
64  int npoints,
65  bool wireframe,
66  bool vertex_promote,
67  bool convexed) = 0;
68 
69  virtual GT_PrimitiveHandle convexSurface(const GT_PrimPolygonMesh *pmesh)=0;
70 
71  GT_PrimitiveHandle convexWithEdgeInfo(const GT_PrimPolygonMesh *pmesh,
74  GT_DataArrayHandle &vch);
75 
76  GT_DataArrayHandle getPointNormals() { return myAutoGenPointN; }
77  void freePointNormals();
78 
79  virtual void updateBoneTransforms(RE_Render *r,
80  const GT_DataArrayHandle &a) = 0;
81 
82  virtual int numMaterials() const = 0;
83 
84  bool myHasAlpha;
85 
86 private:
87  GT_PrimitiveHandle convexMesh(const GT_PrimPolygonMesh *pmesh,
88  const GR_UpdateParms &p,
89  bool &convexed,
90  bool prev_convex_state);
91 
92  void cacheConvexMesh(const GT_PrimitiveHandle &convexed,
93  const GT_PrimPolygonMesh *original);
94  void clearCachedConvexMesh();
95 
96  bool myNeedsConvex;
97  GT_PrimitiveHandle myOriginalGeo;
98  GT_PrimitiveHandle myConvexGeo;
99  GT_DataArrayHandle myAutoGenPointN;
100  int64 myTopVersion;
101  int64 myMatIDVersion;
102 
103  GT_DataArrayHandle myConvexUniformIndirect;
104  GT_DataArrayHandle myConvexVertexIndirect;
105  GT_DataArrayHandle myConvexVertexList;
106  GT_DataArrayHandle myConvexPrimInfo;
107  GT_DataArrayHandle myConvexVertInfo;
108  UT_Pair<int64, int64> myConvexVersion;
109 };
110 #endif
111 
A mesh of polygons.
GT_API const UT_StringHolder cache_name
GT_PrimitiveHandle getConvexGeometry()
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
virtual exint getNumGLPrimitives() const =0
set of parameters sent to GR_Primitive::update()
long long int64
Definition: SYS_Types.h:107
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:38
int64 exint
Definition: SYS_Types.h:116
virtual bool hasTransparency() const
returns true if this drawable renders some transparent elements
#define GR_API
Definition: GR_API.h:10
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
Simple class for a mutli-integer cache tag.
GLboolean r
Definition: glcorearb.h:1221