HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 int buildVertexAttributes(RE_Render *r,
49  const GT_PrimPolygonMesh *pmesh,
50  const GR_UpdateParms &p,
51  bool needs_normal,
52  bool needs_uv,
53  bool new_geo,
54  bool &vertex_promote) = 0;
55 
56  // build based on a Material Atlas
57  virtual void buildConnectivity(RE_Render *r,
58  const GT_PrimPolygonMesh *pmesh,
59  const char *cache_name,
60  RE_CacheVersion geo_version,
61  const RE_MaterialAtlas &mats,
62  int npoints,
63  bool wireframe,
64  bool vertex_promote,
65  bool convexed) = 0;
66 
67  virtual GT_PrimitiveHandle convexSurface(const GT_PrimPolygonMesh *pmesh)=0;
68 
69  virtual bool getMayCacheConvexedPrimitive() const
70  { return true; }
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;
86 
87 private:
88  GT_PrimitiveHandle convexMesh(const GT_PrimPolygonMesh *pmesh,
89  const GR_UpdateParms &p,
90  bool &convexed,
91  bool prev_convex_state);
92 
93  void cacheConvexMesh(const GT_PrimitiveHandle &convexed,
94  const GT_PrimPolygonMesh *original);
95  void clearCachedConvexMesh();
96 
97  bool myNeedsConvex;
98  GT_PrimitiveHandle myOriginalGeo;
99  GT_PrimitiveHandle myConvexGeo;
100  GT_DataArrayHandle myAutoGenPointN;
101  int64 myPVersion;
102  int64 myTopVersion;
103  int64 myMatIDVersion;
104  GT_DataArrayHandle myConvexUniformIndirect;
105  GT_DataArrayHandle myConvexVertexIndirect;
106 };
107 #endif
108 
A mesh of polygons.
GT_PrimitiveHandle getConvexGeometry()
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
virtual bool getMayCacheConvexedPrimitive() const
virtual exint getNumGLPrimitives() const =0
set of parameters sent to GR_Primitive::update()
long long int64
Definition: SYS_Types.h:100
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:38
int64 exint
Definition: SYS_Types.h:109
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 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