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_GeoRenderGL.h"
16 
17 #include <GT/GT_Primitive.h>
18 
19 #include <UT/UT_NonCopyable.h>
20 #include <UT/UT_Vector3.h>
21 
22 #include <utility>
23 
24 class GT_DataArray;
25 class GT_PrimPolygonMesh;
26 
28 {
29 public:
30  static GR_PolySurface *create(GR_Primitive *parent, bool convex);
31 
33  bool needs_convexing);
34  ~GR_PolySurface() override;
35 
36  const char *className() const override { return "GR_PolySurface"; }
37 
39  const GT_PrimitiveHandle &primh,
40  const GR_UpdateParms &p,
41  const char *cache_name) override;
42 
43  bool hasTransparency() const override
44  { return (myHasAlpha || myHasTransparentMaterial); }
45 
46  GT_PrimitiveHandle getConvexGeometry() { return myConvexGeo; }
47 
48  exint getNumGLPrimitives() const override;
49 
50 protected:
51  void retireGeometry() override;
52 
53  virtual int buildVertexAttributes(RE_Render *r,
54  const GT_PrimPolygonMesh *pmesh,
55  const GR_UpdateParms &p,
56  bool needs_normal,
57  bool needs_uv,
58  bool needs_tangent,
59  bool new_geo,
60  bool &vertex_promote) = 0;
61 
62  // build based on a Material Atlas
63  virtual void buildConnectivity(RE_Render *r,
64  const GT_PrimPolygonMesh *pmesh,
65  const char *cache_name,
66  RE_CacheVersion geo_version,
67  const RE_MaterialAtlas &mats,
68  int npoints,
69  bool wireframe,
70  bool vertex_promote,
71  bool convexed) = 0;
72 
73  virtual GT_PrimitiveHandle convexSurface(const GT_PrimPolygonMesh *pmesh)=0;
74 
75  GT_PrimitiveHandle convexWithEdgeInfo(const GT_PrimPolygonMesh *pmesh,
78  GT_DataArrayHandle &vch);
79 
80  GT_DataArrayHandle getPointNormals() { return myAutoGenPointN; }
81  void freePointNormals();
82 
83  virtual bool updateBoneTransforms(RE_Render *r,
84  const GT_DataArrayHandle &a) = 0;
85 
86  virtual bool updateBlendShapeWeights(RE_Render *r,
87  const GT_DataArrayHandle &weights_attr) = 0;
88 
89  virtual int numMaterials() const = 0;
90 
91  bool myHasAlpha;
94 
95 private:
96  GT_PrimitiveHandle convexMesh(const GT_PrimPolygonMesh *pmesh,
97  const GR_UpdateParms &p,
98  bool &convexed,
99  bool prev_convex_state);
100 
101  void cacheConvexMesh(const GT_PrimitiveHandle &convexed,
102  const GT_PrimPolygonMesh *original);
103  void clearCachedConvexMesh();
104 
105  bool myNeedsConvex;
106  GT_PrimitiveHandle myOriginalGeo;
107  GT_PrimitiveHandle myConvexGeo;
108  GT_DataArrayHandle myAutoGenPointN;
109  int64 myTopVersion;
110  int64 myMatIDVersion;
111 
112  GT_DataArrayHandle myConvexUniformIndirect;
113  GT_DataArrayHandle myConvexVertexIndirect;
114  GT_DataArrayHandle myConvexVertexList;
115  GT_DataArrayHandle myConvexPrimInfo;
116  GT_DataArrayHandle myConvexVertInfo;
117  std::pair<int64, int64> myConvexVersion;
118 };
119 #endif
120 
A mesh of polygons.
int64 exint
Definition: SYS_Types.h:125
GT_API const UT_StringHolder cache_name
GT_PrimitiveHandle getConvexGeometry()
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
void retireGeometry() override
Temporary container for either a RV_Render and an RE_Render.
virtual exint getNumGLPrimitives() const =0
set of parameters sent to GR_Primitive::update()
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:40
#define GR_API
Definition: GR_API.h:10
bool myHasTransparentMaterial
long long int64
Definition: SYS_Types.h:116
GT_DataArrayHandle getPointNormals()
const char * className() const override
Simple class for a mutli-integer cache tag.
virtual void update(RE_RenderContext r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p, const char *cache_name)=0
GLboolean r
Definition: glcorearb.h:1222
bool hasTransparency() const override
returns true if this drawable renders some transparent elements