HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUI_PrimitiveHook.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: GUI_PrimitiveHook.h ( GR Library, C++)
7  *
8  * COMMENTS:
9  * Base class for generating custom GR primitives.
10  */
11 #ifndef GUI_PRIMITIVE_HOOK_H
12 #define GUI_PRIMITIVE_HOOK_H
13 
14 #include "GUI_API.h"
15 #include <GR/GR_Defines.h>
16 #include <GR/GR_RenderInfo.h>
17 #include <GT/GT_PrimitiveTypes.h>
18 #include <GT/GT_Primitive.h>
19 #include <GA/GA_PrimitiveTypes.h>
20 #include <UT/UT_ValArray.h>
21 #include <UT/UT_String.h>
22 
23 class GR_Primitive;
24 class GEO_Primitive;
25 
26 #define GUI_PRIMITIVE_HOOK_VERSION 3
27 
28 /// Special modifiers to primitive hooks which provide different behaviours.
29 /// They may be combined, except for GUI_HOOK_FLAG_PRIM_FILTER which cannot
30 /// have any other flags.
32 {
33  /// Hook has no special behaviour.
35 
36  /// Hook will render extra bits, but still allow lower-priority hooks or
37  /// the native primitive renderer to render as well.
39 
40  /// Hook will modify the geometry and produce a new GT_Primitive, but not
41  /// do any rendering itself.
43 };
44 
46 {
47  GUI_RENDER_MASK_GL1 = 0x1, // Deprecated: GL1 and GL2 are obsolete and
48  GUI_RENDER_MASK_GL2 = 0x2, // provided only for H13 code compatibility.
49 
50  GUI_RENDER_MASK_GL3 = 0x4, // Hook works with GL3
51  GUI_RENDER_MASK_GL4 = 0x8, // Hook works only with GL4+
52 
53  GUI_RENDER_MASK_ALL = 0xFFFFFFFC // all but GL1/GL2.
54 };
55 
57 {
62 };
63 
64 
66 {
67 public:
68  /// Only one primitive hook will ever be created.
69  /// Each hook requires a name for identification and error reporting.
70  /// A hook can target all renderers, a subset, or a specific renderer.
71  GUI_PrimitiveHook(const char *hook_name,
73 
74  /// Name of this hook
75  const char * getName() const { return myName; }
76 
77  /// Bitmask of renderers supported by this hook.
78  GUI_RenderMask getRenderMask() const { return myRenderMask; }
79 
80  /// Create a new primitive based on the GT or GEO prim. The info and
81  /// cache_name should be passed to the GR_Primitive constructor.
82  /// 'processed' should indicate that the primitive is consumed
83  /// (GR_PROCESSED), or processed but available for further hooks or
84  /// internal Houdini processing (GR_PROCESSED_NON_EXCLUSIVE).
85  /// GR_NOT_PROCESSED should only be returned if a GR_Primitive was not
86  /// created. Hooks with GUI_HOOK_FLAG_PRIM_FILTER do not call this method.
87  virtual GR_Primitive *createPrimitive(const GT_PrimitiveHandle &gt_prim,
88  const GEO_Primitive *geo_prim,
89  const GR_RenderInfo *info,
90  const char *cache_name,
91  GR_PrimAcceptResult &processed);
92 
93  /// For hooks with GUI_HOOK_FLAG_PRIM_FILTER, this method is called instead
94  /// of createPrimitive.
95  virtual GT_PrimitiveHandle filterPrimitive(const GT_PrimitiveHandle &gt_prm,
96  const GEO_Primitive *geo_prm,
97  const GR_RenderInfo *info,
98  GR_PrimAcceptResult &processed);
99 protected:
100  virtual ~GUI_PrimitiveHook();
101 
102 private:
103  UT_String myName;
104  GUI_RenderMask myRenderMask;
105 
106  friend class DM_RenderTable;
107 };
108 
109 #endif
GT_API const UT_StringHolder cache_name
GLint GLuint mask
Definition: glcorearb.h:123
const char * getName() const
Name of this hook.
GUI_GeometryOptionFlags
Hook has no special behaviour.
#define GUI_API
Definition: GUI_API.h:10
GUI_RenderMask getRenderMask() const
Bitmask of renderers supported by this hook.
GR_PrimAcceptResult
Definition: GR_Defines.h:328
GUI_RenderMask
GUI_PrimitiveHookFlags