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  GUI_RENDER_MASK_VULKAN = 0x10, // Hook works with Vulkan
53 
54  GUI_RENDER_MASK_ALL = 0xFFFFFFFC // all but GL1/GL2.
55 };
56 
58 {
63 };
64 
65 
67 {
68 public:
69  /// Only one primitive hook will ever be created.
70  /// Each hook requires a name for identification and error reporting.
71  /// A hook can target all renderers, a subset, or a specific renderer.
72  GUI_PrimitiveHook(const char *hook_name,
74 
75  /// Name of this hook
76  const char * getName() const { return myName; }
77 
78  /// Bitmask of renderers supported by this hook.
79  GUI_RenderMask getRenderMask() const { return myRenderMask; }
80 
81  /// Create a new primitive based on the GT or GEO prim. The info and
82  /// cache_name should be passed to the GR_Primitive constructor.
83  /// 'processed' should indicate that the primitive is consumed
84  /// (GR_PROCESSED), or processed but available for further hooks or
85  /// internal Houdini processing (GR_PROCESSED_NON_EXCLUSIVE).
86  /// GR_NOT_PROCESSED should only be returned if a GR_Primitive was not
87  /// created. Hooks with GUI_HOOK_FLAG_PRIM_FILTER do not call this method.
88  virtual GR_Primitive *createPrimitive(const GT_PrimitiveHandle &gt_prim,
89  const GEO_Primitive *geo_prim,
90  const GR_RenderInfo *info,
91  const char *cache_name,
92  GR_PrimAcceptResult &processed);
93 
94  /// For hooks with GUI_HOOK_FLAG_PRIM_FILTER, this method is called instead
95  /// of createPrimitive.
96  virtual GT_PrimitiveHandle filterPrimitive(const GT_PrimitiveHandle &gt_prm,
97  const GEO_Primitive *geo_prm,
98  const GR_RenderInfo *info,
99  GR_PrimAcceptResult &processed);
100 protected:
101  virtual ~GUI_PrimitiveHook();
102 
103 private:
104  UT_String myName;
105  GUI_RenderMask myRenderMask;
106 
107  friend class DM_RenderTable;
108 };
109 
110 #endif
GT_API const UT_StringHolder cache_name
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.
GLint GLuint mask
Definition: glcorearb.h:124
GR_PrimAcceptResult
Definition: GR_Defines.h:359
GUI_RenderMask
GUI_PrimitiveHookFlags