HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_PrimAgentShape.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_PrimAgentShape.h (GR Library, C++)
7  *
8  * COMMENTS:
9  */
10 #ifndef GR_PrimAgentShape_h
11 #define GR_PrimAgentShape_h
12 
13 #include "GR_PrimPacked.h"
14 #include <GT/GT_PrimAgentShape.h>
15 
17 {
18 public:
19  GR_PrimAgentShape(const GR_RenderInfo *info,
20  const char *cache_name,
21  const GT_PrimitiveHandle &pack_prim,
22  const GT_PrimitiveHandle &shape_prim);
23  virtual ~GR_PrimAgentShape();
24 
25  virtual const char *className() const { return "GR_PrimAgentShape"; }
26 
28  { return GR_BASE_PRIM_AGENT_SHAPE; }
29 
31  int geo_type,
32  const GT_PrimitiveHandle &ph,
33  const GEO_Primitive *prim);
34 
35  virtual GR_DispOptChange displayOptionChange(const GR_DisplayOption &opt,
36  bool first_init);
37 
38  virtual void update(RE_Render *r,
39  const GT_PrimitiveHandle &primh,
40  const GR_UpdateParms &p);
41 
42  virtual void render(RE_Render *r,
43  GR_RenderMode render_mode,
45  GR_DrawParms dp);
46 
47  virtual int renderPick(RE_Render *r,
48  const GR_DisplayOption *opt,
49  unsigned int pick_type,
50  GR_PickStyle pick_style,
51  bool has_pick_map);
52 
53  virtual bool updateOnViewChange(const GR_DisplayOption &opt) const
54  { return opt.shadingMode() >= GR_FLAT_SHADED; }
55  virtual void viewUpdate(RE_Render *r,
56  const GR_ViewUpdateParms &parms);
57 
58  virtual bool inViewFrustum(const UT_Matrix4D &objviewprojj,
59  const UT_BoundingBoxD *bbox = nullptr)
60  { return myVisibilityFlag; }
61 
62  virtual bool requiresAlphaPass() const { return false; }
63  virtual bool getSingleTransform(UT_Matrix4D &mat) const
64  { return false; }
65 
66 private:
67  void processVisibility(RE_Render *r,
68  const GR_DisplayOption &dopts);
69  void updateTransforms(RE_Render *r,
70  const GU_ConstDetailHandle &geo,
71  bool geo_changed);
72  void updateInstanceTransforms(RE_Render *r,
73  const GU_ConstDetailHandle &geo,
74  bool geo_changed);
75  void updateRigTransforms(RE_Render *r,
76  const GU_ConstDetailHandle &geo,
77  bool geo_changed);
78  void processSelection(RE_Render *r,
79  const RE_CacheVersion &select_ver);
80  void freeVertexArrays();
81  void updatePrimID(RE_Render *r, bool geo_changed);
82  void updateColor(RE_Render *r, bool geo_changed);
83 
84  int myLODLevel;
85  int myTotalAgents;
86  int64 myLastInstVersion;
87  int myTransformSerial;
88  int mySelectionSerial;
89  int myRigSerial;
90  GT_ShapeLODGroupHandle myShapeGroup;
91  UT_IntArray myTransformIndexMap;
92  GR_UpdateReason myDeferredReason;
93  bool myDeformingShape;
94  bool myVisibilityFlag;
95  bool myLastWire;
96  bool myLastLODEnable;
97  fpreal myLastLODBias;
98  int myLastLODBase;
99 
100  // Only the primary LOD holds any of these.
101  UT_Array<RE_VertexArray *> myTransformVA;
102  UT_Array<RE_VertexArray *> myRigTransformVA;
103  UT_Array<RE_VertexArray *> myShapeSelectionVA;
104  UT_Array<RE_VertexArray *> myPrimIDVA;
106 };
107 
108 
109 
110 #endif
virtual bool requiresAlphaPass() const
Return true if this primitive requires an alpha pass.
RE_VertexArray * myColorVA
virtual void render(RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp)
Set of parameters sent to GR_Primitive::viewUpdate().
void shadingMode(GR_ShadingMode shading_mode)
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
Definition: glew.h:2864
GT_API const UT_StringHolder cache_name
virtual void viewUpdate(RE_Render *r, const GR_ViewUpdateParms &parms)
virtual GR_BasePrimType getBasePrimType() const
The base primitive type is usually NORMAL unless this is a packed type.
virtual bool getSingleTransform(UT_Matrix4D &mat) const
virtual bool inViewFrustum(const UT_Matrix4D &objviewprojj, const UT_BoundingBoxD *bbox=nullptr)
virtual GR_PrimAcceptResult acceptPrimitive(GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim)
set of parameters sent to GR_Primitive::update()
long long int64
Definition: SYS_Types.h:111
GR_RenderMode
Definition: GR_Defines.h:44
GR_BasePrimType
Definition: GR_Defines.h:338
#define GR_API
Definition: GR_API.h:10
GR_UpdateReason
Definition: GR_Defines.h:288
GR_PrimAcceptResult
Definition: GR_Defines.h:331
GR_RenderFlags
Definition: GR_Defines.h:80
GT_PrimitiveType
GLfloat GLfloat p
Definition: glew.h:16321
virtual GR_DispOptChange displayOptionChange(const GR_DisplayOption &opts, bool first_init)
double fpreal
Definition: SYS_Types.h:276
virtual int renderPick(RE_Render *r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map)
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
Simple class for a mutli-integer cache tag.
virtual void update(RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p)
virtual const char * className() const
Return a string version of this class's name.
virtual bool updateOnViewChange(const GR_DisplayOption &opt) const
If this primitive requires an update when the view changes, return true.
GLdouble GLdouble t
Definition: glew.h:1398
GR_PickStyle
Definition: GR_Defines.h:230