HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GR_PrimTetra.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  * Produced by:
7  * Side Effects Software Inc
8  * 123 Front Street West, Suite 1401
9  * Toronto, Ontario
10  * Canada M5J 2M2
11  * 416-504-9876
12  *
13  * NAME: GR_PrimTetra.h (GR Library, C++)
14  *
15  * COMMENTS:
16  */
17 
18 #ifndef __GR_PrimTetra__
19 #define __GR_PrimTetra__
20 
21 #include <GUI/GUI_PrimitiveHook.h>
22 #include <GR/GR_Primitive.h>
23 
24 namespace HDK_Sample
25 {
26 
27 /// The primitive render hook which creates GR_PrimTetra objects.
29 {
30 public:
32  virtual ~GR_PrimTetraHook();
33 
34  /// This is called when a new GR_Primitive is required for a tetra.
35  /// gt_prim or geo_prim contains the GT or GEO primitive this object is being
36  /// created for, depending on whether this hook is registered to capture
37  /// GT or GEO primitives.
38  /// info and cache_name should be passed down to the GR_Primitive
39  /// constructor.
40  /// processed should return GR_PROCESSED or GR_PROCESSED_NON_EXCLUSIVE if
41  /// a primitive is created. Non-exclusive allows other render hooks or the
42  /// native Houdini primitives to be created for the same primitive, which is
43  /// useful for support hooks (drawing decorations, bounding boxes, etc).
44  virtual GR_Primitive *createPrimitive(const GT_PrimitiveHandle &gt_prim,
45  const GEO_Primitive *geo_prim,
46  const GR_RenderInfo *info,
47  const char *cache_name,
48  GR_PrimAcceptResult &processed);
49 };
50 
51 /// Primitive object that is created by GR_PrimTetraHook whenever a
52 /// tetrahedron primitive is found. This object can be persistent between
53 /// renders, though display flag changes or navigating though SOPs can cause
54 /// it to be deleted and recreated later.
55 class GR_PrimTetra : public GR_Primitive
56 {
57 public:
58  GR_PrimTetra(const GR_RenderInfo *info,
59  const char *cache_name,
60  const GEO_Primitive *prim);
61  virtual ~GR_PrimTetra();
62 
63  virtual const char *className() const { return "GR_PrimTetra"; }
64 
65  /// See if the tetra primitive can be consumed by this primitive. Only
66  /// tetra from the same detail will ever be passed in. If the primitive hook
67  /// specifies GUI_HOOK_COLLECT_PRIMITIVES then it is possible to have this
68  /// called more than once for different GR_Primitives. A GR_Primitive that
69  /// collects multiple GT or GEO primitives is responsible for keeping track
70  /// of them (in a list, table, etc).
72  int geo_type,
73  const GT_PrimitiveHandle &ph,
74  const GEO_Primitive *prim);
75 
76  /// For collection primitives (GUI_HOOK_COLLECT_PRIMITIVES), this is called
77  /// before traversing the primitives. It will not be called for
78  /// GUI_HOOK_PER_PRIMITIVE hooks. This should reset any lists of primitives.
79  virtual void resetPrimitives();
80 
81 
82  /// Called whenever the parent detail is changed, draw modes are changed,
83  /// selection is changed, or certain volatile display options are changed
84  /// (such as level of detail).
85  virtual void update(RE_Render *r,
86  const GT_PrimitiveHandle &primh,
87  const GR_UpdateParms &p);
88 
89  /// Called whenever the primitive is required to render, which may be more
90  /// than one time per viewport redraw (beauty, shadow passes, wireframe-over)
91  /// It also may be called outside of a viewport redraw to do picking of the
92  /// geometry.
93  virtual void render(RE_Render *r,
94  GR_RenderMode render_mode,
96  GR_DrawParms dp);
97  virtual void renderDecoration(RE_Render *r,
98  GR_Decoration decor,
99  const GR_DecorationParms &parms);
100  virtual int renderPick(RE_Render *r,
101  const GR_DisplayOption *opt,
102  unsigned int pick_type,
103  GR_PickStyle pick_style,
104  bool has_pick_map);
105 private:
106  int myID;
107  RE_Geometry *myGeo;
108  bool myInstancedFlag;
109 
110 #ifdef TETRA_GR_PRIM_COLLECTION
111  GA_IndexArray myPrimIndices;
112 #endif
113 };
114 
115 
116 
117 } // End HDK_Sample namespace.
118 
119 #endif
virtual void renderDecoration(RE_Render *r, GR_Decoration decor, const GR_DecorationParms &parms)
Definition: GR_PrimTetra.C:441
virtual GR_PrimAcceptResult acceptPrimitive(GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim)
Definition: GR_PrimTetra.C:83
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
GLbitfield flags
Definition: glcorearb.h:1595
GR_Decoration
Definition: GR_Defines.h:137
virtual void resetPrimitives()
Definition: GR_PrimTetra.C:73
virtual int renderPick(RE_Render *r, const GR_DisplayOption *opt, unsigned int pick_type, GR_PickStyle pick_style, bool has_pick_map)
Definition: GR_PrimTetra.C:452
set of parameters sent to GR_Primitive::update()
GR_RenderMode
Definition: GR_Defines.h:42
The primitive render hook which creates GR_PrimTetra objects.
Definition: GR_PrimTetra.h:28
virtual const char * className() const
Return a string version of this class's name.
Definition: GR_PrimTetra.h:63
virtual GR_Primitive * createPrimitive(const GT_PrimitiveHandle &gt_prim, const GEO_Primitive *geo_prim, const GR_RenderInfo *info, const char *cache_name, GR_PrimAcceptResult &processed)
Definition: GR_PrimTetra.C:44
GR_PrimAcceptResult
Definition: GR_Defines.h:320
GR_RenderFlags
Definition: GR_Defines.h:77
GT_PrimitiveType
virtual void update(RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p)
Definition: GR_PrimTetra.C:102
virtual void render(RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp)
Definition: GR_PrimTetra.C:318
GR_PrimTetra(const GR_RenderInfo *info, const char *cache_name, const GEO_Primitive *prim)
Definition: GR_PrimTetra.C:53
GLboolean r
Definition: glcorearb.h:1221
GR_PickStyle
Definition: GR_Defines.h:226