HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_PrimAgents.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_PrimAgents ( GR Library, C++)
7  *
8  * COMMENTS:
9  * Rendering class for agent decorations, bounding boxes
10  */
11 #ifndef GR_PrimAgents_h
12 #define GR_PrimAgents_h
13 
14 #include "GR_Primitive.h"
15 
16 #include <UT/UT_ValArray.h>
17 #include <UT/UT_BoundingBox.h>
18 #include <UT/UT_VectorTypes.h>
19 #include <GT/GT_GEOPackedAgent.h>
20 
22 {
23 public:
24  GR_PrimAgents(const GR_RenderInfo *info,
25  const char *cache_name);
26  ~GR_PrimAgents() override;
27 
28 
29  const char *className() const override { return "GR_PrimAgents"; }
30 
32  const GT_PrimitiveHandle &,
33  const GEO_Primitive *) override;
34 
36  bool first_init) override;
37  void update(RE_Render *r,
38  const GT_PrimitiveHandle &primh,
39  const GR_UpdateParms &p) override;
40 
41  // update the visibility info.
43  const GR_DisplayOption &) const override
44  { return true; }
45  void viewUpdate(RE_Render *r,
46  const GR_ViewUpdateParms &parms) override;
47 
48  void render(RE_Render *r,
49  GR_RenderMode render_mode,
50  GR_RenderFlags render_flags,
51  GR_DrawParms dp) override;
52 
53  int renderPick(RE_Render *r,
54  const GR_DisplayOption *opts,
55  unsigned int pickmask,
56  GR_PickStyle pickstyle,
57  bool has_pick_map) override;
58 
59  void renderDecoration(
60  RE_Render *r,
61  GR_Decoration decor,
62  const GR_DecorationParms &parms) override;
63 private:
64 
65  void updateVisibility(RE_Render *r,
66  const GR_FrustumList &view_frustums);
67  void buildSkeleton(RE_Render *r, const GT_GEOPackedAgent *agents);
68  void updateBones(RE_Render *r, const GT_GEOPackedAgent *agent,
69  bool geo_changed);
70  void updateAgentColor(RE_Render *r, const GT_GEOPackedAgent *agent,
71  const RE_CacheVersion &version);
72  void updateSelection(RE_Render *r,
73  const GT_GEOPackedAgent *agent,
74  const GR_UpdateParms &p);
75 
76  GT_PrimitiveHandle myAgent;
77  GT_AgentVisibilityHandle myVisibility;
78  UT_BoundingBox myWorstCaseBounds;
79  UT_Array<UT_BoundingBox> myBounds;
80  UT_Vector3FArray myPos;
81  UT_IntArray myPrimID;
82 
83  UT_Matrix4FArray myMats;
84  UT_IntArray myBoneTransformIndices;
85  UT_ValArray<UT_QuaternionF> myBoneQuats;
86 
87  RE_Geometry *myPoints;
88  RE_Geometry *myPrimAnchors;
89  RE_Geometry *myBBoxes;
90  RE_Geometry *myBaseDisc;
91  RE_Geometry *myBones;
92 
93  RE_VertexArray *myBoneTransformsVA;
94  int myLastTransformSerial;
95  fpreal myWorstCaseOverestimate;
96 
97  unsigned myLastHullDisplay : 1,
98  myLastWireOver:1,
99  myLastWire:1,
100  myBoneRigDirty:1,
101  myBonesVisible:1,
102  myObjectSelected:1,
103  myDiscsDirty:1,
104  myBBoxDirty:1;
105  RE_VertexArray *myColorVA;
106  RE_VertexArray *mySelectionVA;
107  RE_VertexArray *myPointSelectionVA;
108  GR_SelectMode mySelectMode;
109  GR_AgentWireMode myAgentWireMode;
110  UT_IntArray myBoneSerialCounts;
111  int myBoneSerial;
112  int64 myBoneVisibleHash;
113  UT_Matrix4FArray myBoneMatrixBuffer;
114 };
115 
116 #endif
GR_PrimAcceptResult acceptPrimitive(GT_PrimitiveType t, int, const GT_PrimitiveHandle &, const GEO_Primitive *) override
Set of parameters sent to GR_Primitive::viewUpdate().
GR_DispOptChange displayOptionChange(const GR_DisplayOption &opts, bool first_init) override
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
GT_API const UT_StringHolder cache_name
void update(RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p) override
GR_AgentWireMode
Definition: GR_Defines.h:360
GR_Decoration
Definition: GR_Defines.h:142
Contains a list of agents.
set of parameters sent to GR_Primitive::update()
GR_RenderMode
Definition: GR_Defines.h:44
int renderPick(RE_Render *r, const GR_DisplayOption *opts, unsigned int pickmask, GR_PickStyle pickstyle, bool has_pick_map) override
void render(RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags render_flags, GR_DrawParms dp) override
long long int64
Definition: SYS_Types.h:116
void viewUpdate(RE_Render *r, const GR_ViewUpdateParms &parms) override
GR_PrimAcceptResult
Definition: GR_Defines.h:332
GR_RenderFlags
Definition: GR_Defines.h:81
GT_API const UT_StringHolder version
GT_PrimitiveType
GLfloat GLfloat p
Definition: glew.h:16321
void renderDecoration(RE_Render *r, GR_Decoration decor, const GR_DecorationParms &parms) override
const char * className() const override
Return a string version of this class's name.
Definition: GR_PrimAgents.h:29
fpreal64 fpreal
Definition: SYS_Types.h:277
bool updateOnViewChange(const GR_DisplayOption &) const override
If this primitive requires an update when the view changes, return true.
Definition: GR_PrimAgents.h:42
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
~GR_PrimAgents() override
GR_PrimAgents(const GR_RenderInfo *info, const char *cache_name)
Simple class for a mutli-integer cache tag.
GLdouble GLdouble t
Definition: glew.h:1398
GR_SelectMode
Definition: GR_Defines.h:220
GR_PickStyle
Definition: GR_Defines.h:231