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  ~GR_PrimAgentShape() override;
24 
25  const char *className() const override { 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) override;
34 
35  GR_DispOptChange displayOptionChange(const GR_DisplayOption &opt,
36  bool first_init) override;
37 
38  void update(RE_Render *r,
39  const GT_PrimitiveHandle &primh,
40  const GR_UpdateParms &p) override;
41 
42  void render(RE_Render *r,
43  GR_RenderMode render_mode,
45  GR_DrawParms dp) override;
46 
47  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) override;
52 
54  const GR_DisplayOption &opt) const override
55  { return opt.shadingMode() >= GR_FLAT_SHADED; }
56  void viewUpdate(RE_Render *r,
57  const GR_ViewUpdateParms &parms) override;
58 
60  const UT_Matrix4D &objviewprojj,
61  const UT_BoundingBoxD *bbox = nullptr) override
62  { return myVisibilityFlag; }
63 
64  bool requiresAlphaPass() const override { return false; }
65  bool getSingleTransform(UT_Matrix4D &mat) const override
66  { return false; }
67 
68 private:
69  const GT_PrimAgentShape &getShape() const
70  {
71  return *UTverify_cast<const GT_PrimAgentShape *>(myPackedPrim.get());
72  }
73 
74  void processVisibility(RE_Render *r,
75  const GR_DisplayOption &dopts);
76  void updateTransforms(RE_Render *r,
77  const GU_ConstDetailHandle &geo,
78  bool geo_changed);
79  void updateInstanceTransforms(RE_Render *r,
80  const GU_ConstDetailHandle &geo,
81  bool geo_changed);
82  void updateRigTransforms(RE_Render *r,
83  const GU_ConstDetailHandle &geo,
84  bool geo_changed);
85  void updateBlendWeights(RE_Render *r,
86  const GU_ConstDetailHandle &geo,
87  bool geo_changed);
88  void processSelection(RE_Render *r,
89  const RE_CacheVersion &select_ver);
90  void freeVertexArrays();
91  void updatePrimID(RE_Render *r, bool geo_changed);
92  void updateColor(RE_Render *r, bool geo_changed);
93 
94  int myLODLevel;
95  int myTotalAgents;
96  int64 myLastInstVersion;
97  int myTransformSerial;
98  int mySelectionSerial;
99  int myRigSerial;
100  GT_ShapeLODGroupHandle myShapeGroup;
101  UT_IntArray myTransformIndexMap;
102  GR_UpdateReason myDeferredReason;
103  bool myDeformingShape;
104  bool myVisibilityFlag;
105  bool myLastWire;
106  bool myLastLODEnable;
107  fpreal myLastLODBias;
108  int myLastLODBase;
109 
110  // Only the primary LOD holds any of these.
111  UT_Array<RE_VertexArray *> myTransformVA;
112  UT_Array<RE_VertexArray *> myRigTransformVA;
113  UT_Array<RE_VertexArray *> myBlendWeightVA;
114  UT_Array<RE_VertexArray *> myShapeSelectionVA;
115  UT_Array<RE_VertexArray *> myPrimIDVA;
117 };
118 
119 
120 
121 #endif
bool inViewFrustum(const UT_Matrix4D &objviewprojj, const UT_BoundingBoxD *bbox=nullptr) override
RE_VertexArray * myColorVA
Set of parameters sent to GR_Primitive::viewUpdate().
void shadingMode(GR_ShadingMode shading_mode)
GT_API const UT_StringHolder cache_name
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
Definition: UT_Assert.h:244
void viewUpdate(RE_Render *r, const GR_ViewUpdateParms &parms) override
GLdouble GLdouble t
Definition: glew.h:1403
set of parameters sent to GR_Primitive::update()
GR_RenderMode
Definition: GR_Defines.h:46
GR_BasePrimType
Definition: GR_Defines.h:345
void render(RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp) override
GR_PrimAcceptResult acceptPrimitive(GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim) override
#define GR_API
Definition: GR_API.h:10
GR_UpdateReason
Definition: GR_Defines.h:295
long long int64
Definition: SYS_Types.h:116
GLfloat GLfloat p
Definition: glew.h:16656
bool updateOnViewChange(const GR_DisplayOption &opt) const override
If this primitive requires an update when the view changes, return true.
GR_PrimAcceptResult
Definition: GR_Defines.h:338
GR_RenderFlags
Definition: GR_Defines.h:84
GLbitfield flags
Definition: glcorearb.h:1595
const char * className() const override
Return a string version of this class's name.
GT_PrimitiveType
GR_DispOptChange displayOptionChange(const GR_DisplayOption &opts, bool first_init) override
fpreal64 fpreal
Definition: SYS_Types.h:277
A shape belonging to agents, instanced with material assignments.
GR_BasePrimType getBasePrimType() const override
The base primitive type is usually NORMAL unless this is a packed type.
bool requiresAlphaPass() const override
Return true if this primitive requires an alpha pass.
Simple class for a mutli-integer cache tag.
GLboolean r
Definition: glcorearb.h:1221
bool getSingleTransform(UT_Matrix4D &mat) const override
int renderPick(RE_Render *r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map) override
void update(RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p) override
GR_PickStyle
Definition: GR_Defines.h:235