HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DM_SceneHook.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: DM_SceneHook.h ( DM Library, C++)
7  *
8  * COMMENTS:
9  * Base class to hook into various parts of the scene rendering pipeline.
10  */
11 #ifndef DM_SCENE_HOOK_H
12 #define DM_SCENE_HOOK_H
13 
14 #include "DM_API.h"
15 #include "DM_ViewportType.h"
16 
17 #include <UT/UT_String.h>
18 #include <GR/GR_Defines.h>
19 
20 class DM_VPortAgent;
21 class GUI_DisplayOption;
22 class RE_Light;
23 class RE_Render;
24 
25 #define DM_SCENE_HOOK_VERSION 2
26 
27 /// The rendering task that the hook performs.
29 {
38 
39  // Replace-only hooks
42 
44 };
45 
46 /// How the hook augments or replaces the native Houdini rendering task.
48 {
52 };
53 
54 
55 /// Data structure for rendering scene hooks.
57 {
58 public:
59  // class containing all viewport display options
61 
62  // Size of the viewport in pixels
65 
66  // only non-NULL in DM_HOOK_SHADOW and DM_HQ_LIGHT_PASS
68 
69  // In case this is registered more than once to different spots, this
70  // allows the hook to differentiate the callers.
73 };
74 
75 
76 
77 /// Scene render hook instance, which does the actual rendering for a viewport
79 {
80 public:
81  /// A Scene render hook has a parent viewport and a view type mask which
82  /// determines which viewport types it will display in (eg. perspective,
83  /// ortho, UV, all)
85  DM_ViewportType view_mask);
86  virtual ~DM_SceneRenderHook();
87 
88  /// @brief Restrict hook to only certain Viewport Renderer versions
89  /// This method allows you to restrict this hook to only operate in some of
90  /// the viewport renderers (H11 - GL3). If the viewport is set to a
91  /// a renderer and this method returns false, it will be skipped. The
92  /// default action is to support all viewport renderers.
94  { return true; }
95 
96  /// @brief Render method called when the rendering task is required.
97  /// render() performs the rendering task for the hook, or returns false if
98  /// if it cannot. The RE_Render contains the active GL context and the
99  /// hook_data contains viewport-specific and hook-specific data.
100  virtual bool render(RE_Render *r,
101  const DM_SceneHookData &hook_data) = 0;
102 
103  /// @brief Callback method when the viewport is no longer visible.
104  /// Called when the viewport is temporarily closed (quad/single switch, pane
105  /// switch). This gives the hook the opportunity to clean up expensive GL
106  /// objects or caches.
107  virtual void viewportClosed();
108 
109  /// Viewport this scene render is attached to.
110  DM_VPortAgent &viewport() const { return myAgent; }
111  DM_ViewportType getViewportMask() const { return myViewportMask; }
112 
113 private:
114  DM_VPortAgent &myAgent;
115  DM_ViewportType myViewportMask;
116 };
117 
118 
119 
120 /// A Scene Hook creates new scene render hooks when new viewports are created.
122 {
123 public:
124  /// Create a scene hook which creates scene render hook instances for
125  /// specific viewports. Only one scene hook is ever created, and it is
126  /// responsible for managing the scene render hooks for viewports.
127  /// Each hook requires a name (for error reporting) and a priority level
128  /// to resolve multiple scene hook conflicts.
129  DM_SceneHook(const char *hook_name,
130  int priority);
131  virtual ~DM_SceneHook();
132 
133  const char *getName() const { return myHookName; }
134  int getPriority() const { return myPriority; }
135 
136  /// @brief Called when a viewport needs to create a new hook.
137  /// Each viewport has its own scene hook.
138  virtual DM_SceneRenderHook *newSceneRender(DM_VPortAgent &vport,
141 
142  /// @brief Called when a viewport no longer requires the hook.
143  /// When a viewport is destroyed, it retires all its hooks. Because a hook
144  /// could be shared between all viewports, this method gives the scene hook
145  /// the opportunity to delete it, dereference it, etc. The viewport doing
146  /// the retiring is passed in along with the hook it is retiring.
147  virtual void retireSceneRender(DM_VPortAgent &vport,
148  DM_SceneRenderHook *hook) = 0;
149 
150 private:
151  UT_String myHookName;
152  int myPriority;
153 };
154 #endif
virtual bool supportsRenderer(GR_RenderVersion version)
Restrict hook to only certain Viewport Renderer versions This method allows you to restrict this hook...
Definition: DM_SceneHook.h:93
Scene render hook instance, which does the actual rendering for a viewport.
Definition: DM_SceneHook.h:78
hboost::math::policies::policy< hboost::math::policies::domain_error< hboost::math::policies::ignore_error >, hboost::math::policies::pole_error< hboost::math::policies::ignore_error >, hboost::math::policies::overflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::underflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::denorm_error< hboost::math::policies::ignore_error >, hboost::math::policies::rounding_error< hboost::math::policies::ignore_error >, hboost::math::policies::evaluation_error< hboost::math::policies::ignore_error >, hboost::math::policies::indeterminate_result_error< hboost::math::policies::ignore_error > > policy
Definition: SYS_MathCbrt.h:35
DM_ViewportType getViewportMask() const
Definition: DM_SceneHook.h:111
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
Definition: HDK_Image.dox:266
const GUI_DisplayOption * disp_options
Definition: DM_SceneHook.h:60
#define DM_API
Definition: DM_API.h:10
DM_SceneHookType
The rendering task that the hook performs.
Definition: DM_SceneHook.h:28
int getPriority() const
Definition: DM_SceneHook.h:134
Data structure for rendering scene hooks.
Definition: DM_SceneHook.h:56
RE_Light * light
Definition: DM_SceneHook.h:67
GR_RenderVersion
Definition: GR_Defines.h:21
GT_API const UT_StringHolder version
A Scene Hook creates new scene render hooks when new viewports are created.
Definition: DM_SceneHook.h:121
const char * getName() const
Definition: DM_SceneHook.h:133
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
DM_SceneHookPolicy hook_policy
Definition: DM_SceneHook.h:72
GLboolean r
Definition: glcorearb.h:1221
DM_SceneHookPolicy
How the hook augments or replaces the native Houdini rendering task.
Definition: DM_SceneHook.h:47
DM_SceneHookType hook_type
Definition: DM_SceneHook.h:71
int DM_ViewportType
DM_VPortAgent & viewport() const
Viewport this scene render is attached to.
Definition: DM_SceneHook.h:110