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 &objviewproj)
59  { return myVisibilityFlag; }
60 
61  virtual bool requiresAlphaPass() const { return false; }
62  virtual bool getSingleTransform(UT_Matrix4D &mat) const
63  { return false; }
64 
65 private:
66  void processVisibility(RE_Render *r,
67  const GR_DisplayOption &dopts);
68  void updateTransforms(RE_Render *r,
69  const GU_ConstDetailHandle &geo,
70  bool geo_changed);
71  void updateInstanceTransforms(RE_Render *r,
72  const GU_ConstDetailHandle &geo,
73  bool geo_changed);
74  void updateRigTransforms(RE_Render *r,
75  const GU_ConstDetailHandle &geo,
76  bool geo_changed);
77  void processSelection(RE_Render *r,
78  const RE_CacheVersion &select_ver);
79  void freeVertexArrays();
80  void updatePrimID(RE_Render *r, bool geo_changed);
81  void updateColor(RE_Render *r, bool geo_changed);
82 
83  int myLODLevel;
84  int myTotalAgents;
85  int64 myLastInstVersion;
86  int myTransformSerial;
87  int mySelectionSerial;
88  int myRigSerial;
89  GT_ShapeLODGroupHandle myShapeGroup;
90  UT_IntArray myTransformIndexMap;
91  GR_UpdateReason myDeferredReason;
92  bool myDeformingShape;
93  bool myVisibilityFlag;
94  bool myLastWire;
95  bool myLastLODEnable;
96  fpreal myLastLODBias;
97  int myLastLODBase;
98 
99  // Only the primary LOD holds any of these.
100  UT_Array<RE_VertexArray *> myTransformVA;
101  UT_Array<RE_VertexArray *> myRigTransformVA;
102  UT_Array<RE_VertexArray *> mySelectionVA;
103  UT_Array<RE_VertexArray *> myPrimIDVA;
105 };
106 
107 
108 
109 #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)
GT_API const UT_StringHolder cache_name
virtual void viewUpdate(RE_Render *r, const GR_ViewUpdateParms &parms)
GLbitfield flags
Definition: glcorearb.h:1595
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 GR_PrimAcceptResult acceptPrimitive(GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim)
virtual bool inViewFrustum(const UT_Matrix4D &objviewproj)
set of parameters sent to GR_Primitive::update()
long long int64
Definition: SYS_Types.h:107
GR_RenderMode
Definition: GR_Defines.h:44
GR_BasePrimType
Definition: GR_Defines.h:335
#define GR_API
Definition: GR_API.h:10
GR_UpdateReason
Definition: GR_Defines.h:286
GR_PrimAcceptResult
Definition: GR_Defines.h:328
GR_RenderFlags
Definition: GR_Defines.h:79
GT_PrimitiveType
virtual GR_DispOptChange displayOptionChange(const GR_DisplayOption &opts, bool first_init)
double fpreal
Definition: SYS_Types.h:270
virtual int renderPick(RE_Render *r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map)
Simple class for a mutli-integer cache tag.
GLboolean r
Definition: glcorearb.h:1221
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.
GR_PickStyle
Definition: GR_Defines.h:228