HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 collect multiple primitives of the same type.
37  /// DEPRECATED: Use GT Collection primitives instead.
39 
40  /// Hook will render extra bits, but still allow lower-priority hooks or
41  /// the native primitive renderer to render as well.
43 
44  /// Hook will modify the geometry and produce a new GT_Primitive, but not
45  /// do any rendering itself.
47 };
48 
50 {
51  GUI_RENDER_MASK_GL1 = 0x1, // Deprecated: GL1 and GL2 are obsolete and
52  GUI_RENDER_MASK_GL2 = 0x2, // provided only for H13 code compatibility.
53 
54  GUI_RENDER_MASK_GL3 = 0x4, // Hook works with GL3
55  GUI_RENDER_MASK_GL4 = 0x8, // Hook works only with GL4+
56 
57  GUI_RENDER_MASK_ALL = 0xFFFFFFFC // all but GL1/GL2.
58 };
59 
61 {
66 };
67 
68 
70 {
71 public:
72  /// Only one primitive hook will ever be created.
73  /// Each hook requires a name for identification and error reporting.
74  /// A hook can target all renderers, a subset, or a specific renderer.
75  GUI_PrimitiveHook(const char *hook_name,
77 
78  /// Name of this hook
79  const char * getName() const { return myName; }
80 
81  /// Bitmask of renderers supported by this hook.
82  GUI_RenderMask getRenderMask() const { return myRenderMask; }
83 
84  /// Create a new primitive based on the GT or GEO prim. The info and
85  /// cache_name should be passed to the GR_Primitive constructor.
86  /// 'processed' should indicate that the primitive is consumed
87  /// (GR_PROCESSED), or processed but available for further hooks or
88  /// internal Houdini processing (GR_PROCESSED_NON_EXCLUSIVE).
89  /// GR_NOT_PROCESSED should only be returned if a GR_Primitive was not
90  /// created. Hooks with GUI_HOOK_FLAG_PRIM_FILTER do not call this method.
91  virtual GR_Primitive *createPrimitive(const GT_PrimitiveHandle &gt_prim,
92  const GEO_Primitive *geo_prim,
93  const GR_RenderInfo *info,
94  const char *cache_name,
95  GR_PrimAcceptResult &processed);
96 
97  /// For hooks with GUI_HOOK_FLAG_PRIM_FILTER, this method is called instead
98  /// of createPrimitive.
99  virtual GT_PrimitiveHandle filterPrimitive(const GT_PrimitiveHandle &gt_prm,
100  const GEO_Primitive *geo_prm,
101  const GR_RenderInfo *info,
102  GR_PrimAcceptResult &processed);
103 protected:
104  virtual ~GUI_PrimitiveHook();
105 
106 private:
107  UT_String myName;
108  GUI_RenderMask myRenderMask;
109 
110  friend class DM_RenderTable;
111 };
112 
113 #endif
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:320
GUI_RenderMask
GUI_PrimitiveHookFlags