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 #include <UT/UT_UniquePtr.h>
21 
22 class RV_Geometry;
23 class RV_Instance;
24 class GR_InstanceBuffer;
25 
27 {
28 public:
29  GR_PrimAgents(const GR_RenderInfo *info,
30  const char *cache_name);
31  ~GR_PrimAgents() override;
32 
33 
34  const char *className() const override { return "GR_PrimAgents"; }
35 
37  const GT_PrimitiveHandle &,
38  const GEO_Primitive *) override;
39 
40  GR_DispOptChange displayOptionChange(const GR_DisplayOption &opts,
41  bool first_init) override;
42 
43  bool supportsParallelUpdate() const override;
44 
46  const GT_PrimitiveHandle &primh,
47  const GR_UpdateParms &p) override;
48 
49  // update the visibility info.
51  const GR_DisplayOption &) const override
52  { return true; }
54  const GR_ViewUpdateParms &parms) override;
55 
57  GR_RenderMode render_mode,
58  GR_RenderFlags render_flags,
59  GR_DrawParms dp) override;
60 
62  const GR_DisplayOption *opts,
63  unsigned int pickmask,
64  GR_PickStyle pickstyle,
65  bool has_pick_map) override;
66 
67  void renderDecoration(
69  GR_Decoration decor,
70  const GR_DecorationParms &parms) override;
71 
72  static bool initShaders(RV_Instance *inst);
73  static void cleanupShaders();
74 private:
75 
76  void updateVisibility(RE_RenderContext r,
77  const GR_FrustumList &view_frustums);
78  void buildSkeleton(RE_RenderContext r, const GT_GEOPackedAgent *agents);
79  void updateBones(RE_RenderContext r, const GT_GEOPackedAgent *agent,
80  bool geo_changed);
81  void updateAgentColor(RE_RenderContext r, const GT_GEOPackedAgent *agent,
82  const RE_CacheVersion &version);
83  void updateSelection(RE_RenderContext r,
84  const GT_GEOPackedAgent *agent,
85  const GR_UpdateParms &p);
86 
87  GT_PrimitiveHandle myAgent;
88  GT_AgentVisibilityHandle myVisibility;
89  UT_BoundingBox myWorstCaseBounds;
90  UT_Array<UT_BoundingBox> myBounds;
91  UT_Vector3FArray myPos;
92  UT_IntArray myPrimID;
93 
94  UT_Matrix4FArray myMats;
95  UT_IntArray myBoneTransformIndices;
96  UT_ValArray<UT_QuaternionF> myBoneQuats;
97 
98  // Vulkan
99  UT_UniquePtr<RV_Geometry> myPointsGeo;
100  UT_UniquePtr<RV_Geometry> myPrimAnchorsGeo;
101  UT_UniquePtr<RV_Geometry> myBBoxesGeo;
102  UT_UniquePtr<RV_Geometry> myBaseDiscGeo;
103  UT_UniquePtr<RV_Geometry> myBonesGeo;
104 
106  UT_UniquePtr<GR_InstanceBuffer> myInstSelection;
107 
108  UT_UniquePtr<RV_ShaderBlock> myObjUniforms;
110 
111  int myLastTransformSerial;
112 
113  unsigned myLastHullDisplay : 1,
114  myLastWireOver:1,
115  myLastWire:1,
116  myBoneRigDirty:1,
117  myBonesVisible:1,
118  myObjectSelected:1,
119  myDiscsDirty:1,
120  myBBoxDirty:1;
121 
122  GR_SelectMode mySelectMode;
123  GR_AgentWireMode myAgentWireMode;
124  UT_IntArray myBoneSerialCounts;
125  int myBoneSerial;
126  int64 myBoneVisibleHash;
127  UT_Matrix4FArray myBoneMatrixBuffer;
128 };
129 
130 #endif
virtual void render(RE_RenderContext r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp)=0
Set of parameters sent to GR_Primitive::viewUpdate().
SIM_API const UT_StringHolder agent
GT_API const UT_StringHolder cache_name
Object that represents drawable geometry. This object holds vertex, instancing and index buffers for ...
Definition: RV_Geometry.h:165
GR_AgentWireMode
Definition: GR_Defines.h:392
GR_Decoration
Definition: GR_Defines.h:167
Contains a list of agents which share the same rig.
Temporary container for either a RV_Render and an RE_Render.
virtual void viewUpdate(RE_RenderContext r, const GR_ViewUpdateParms &parms)
Definition: GR_Primitive.h:133
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
set of parameters sent to GR_Primitive::update()
virtual int renderPick(RE_RenderContext r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map)=0
GR_RenderMode
Definition: GR_Defines.h:48
RV_API void cleanupShaders()
#define GR_API
Definition: GR_API.h:10
long long int64
Definition: SYS_Types.h:116
virtual void renderDecoration(RE_RenderContext r, GR_Decoration decor, const GR_DecorationParms &parms)
GR_PrimAcceptResult
Definition: GR_Defines.h:364
GR_RenderFlags
Definition: GR_Defines.h:88
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:48
GLdouble t
Definition: glad.h:2397
GT_API const UT_StringHolder version
GT_PrimitiveType
RV_API bool initShaders(RV_Instance *inst)
virtual GR_PrimAcceptResult acceptPrimitive(GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim)=0
GA_API const UT_StringHolder parms
const char * className() const override
Return a string version of this class's name.
Definition: GR_PrimAgents.h:34
bool updateOnViewChange(const GR_DisplayOption &) const override
If this primitive requires an update when the view changes, return true.
Definition: GR_PrimAgents.h:50
virtual void update(RE_RenderContext r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p)=0
Simple class for a mutli-integer cache tag.
GLboolean r
Definition: glcorearb.h:1222
virtual bool supportsParallelUpdate() const
Definition: GR_Primitive.h:287
virtual GR_DispOptChange displayOptionChange(const GR_DisplayOption &opts, bool first_init)
GR_SelectMode
Definition: GR_Defines.h:246
GR_PickStyle
Definition: GR_Defines.h:257