HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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.
68  int geo_type,
69  const GT_PrimitiveHandle &ph,
70  const GEO_Primitive *prim);
71 
72  /// Called whenever the parent detail is changed, draw modes are changed,
73  /// selection is changed, or certain volatile display options are changed
74  /// (such as level of detail).
75  virtual void update(RE_Render *r,
76  const GT_PrimitiveHandle &primh,
77  const GR_UpdateParms &p);
78 
79  /// Called whenever the primitive is required to render, which may be more
80  /// than one time per viewport redraw (beauty, shadow passes, wireframe-over)
81  /// It also may be called outside of a viewport redraw to do picking of the
82  /// geometry.
83  virtual void render(RE_Render *r,
84  GR_RenderMode render_mode,
86  GR_DrawParms dp);
87  virtual void renderDecoration(RE_Render *r,
88  GR_Decoration decor,
89  const GR_DecorationParms &parms);
90  virtual int renderPick(RE_Render *r,
91  const GR_DisplayOption *opt,
92  unsigned int pick_type,
93  GR_PickStyle pick_style,
94  bool has_pick_map);
95 private:
96  int myID;
97  RE_Geometry *myGeo;
98  bool myInstancedFlag;
99 };
100 
101 
102 
103 } // End HDK_Sample namespace.
104 
105 #endif
virtual void renderDecoration(RE_Render *r, GR_Decoration decor, const GR_DecorationParms &parms)
Definition: GR_PrimTetra.C:385
virtual GR_PrimAcceptResult acceptPrimitive(GT_PrimitiveType t, int geo_type, const GT_PrimitiveHandle &ph, const GEO_Primitive *prim)
Definition: GR_PrimTetra.C:70
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
GLbitfield flags
Definition: glcorearb.h:1595
GR_Decoration
Definition: GR_Defines.h:139
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:396
set of parameters sent to GR_Primitive::update()
GR_RenderMode
Definition: GR_Defines.h:44
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:328
GR_RenderFlags
Definition: GR_Defines.h:79
GT_PrimitiveType
virtual void update(RE_Render *r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p)
Definition: GR_PrimTetra.C:83
virtual void render(RE_Render *r, GR_RenderMode render_mode, GR_RenderFlags flags, GR_DrawParms dp)
Definition: GR_PrimTetra.C:262
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:228