HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
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_Rect.h
>
18
#include <
UT/UT_String.h
>
19
#include <
RE/RE_RenderContext.h
>
20
#include <
GR/GR_Defines.h
>
21
#include <
GR/GR_PickRecord.h
>
22
23
class
DM_VPortAgent
;
24
class
GUI_DisplayOption
;
25
class
RE_Light
;
26
class
RE_Render
;
27
class
OP_Node
;
28
29
#define DM_SCENE_HOOK_VERSION 3
30
31
/// The rendering task that the hook performs.
32
enum
DM_SceneHookType
33
{
34
DM_HOOK_BACKGROUND
,
35
DM_HOOK_PRE_RENDER
,
36
DM_HOOK_BEAUTY
,
37
DM_HOOK_BEAUTY_TRANSPARENT
,
38
DM_HOOK_UNLIT
,
39
DM_HOOK_XRAY
,
40
DM_HOOK_POST_RENDER
,
41
DM_HOOK_FOREGROUND
,
42
43
// Replace-only hooks
44
DM_HOOK_SHADOW
,
45
DM_HOOK_HQ_LIGHT_PASS
,
46
47
// Pick renders
48
DM_HOOK_FRAMEBUFFER_PICK
,
49
DM_HOOK_FRUSTUM_PICK
,
50
51
DM_HOOK_FULL_SCENE
52
};
53
54
/// How the hook augments or replaces the native Houdini rendering task.
55
enum
DM_SceneHookPolicy
56
{
57
DM_HOOK_REPLACE_NATIVE
= 0,
58
DM_HOOK_BEFORE_NATIVE
,
59
DM_HOOK_AFTER_NATIVE
60
};
61
62
enum
DM_SceneHookScope
63
{
64
DM_HOOK_OBJSOPDOP_VIEW
= 0x1,
65
DM_HOOK_LOP_VIEW
= 0x2,
66
67
DM_HOOK_ALL_VIEWS
= 0x3
68
};
69
70
/// Data structure for rendering scene hooks.
71
class
DM_API
DM_SceneHookData
72
{
73
public
:
74
// class containing all viewport display options
75
const
GUI_DisplayOption
*
disp_options
;
76
77
// Size of the viewport in pixels
78
int
view_width
;
79
int
view_height
;
80
81
// only non-NULL in DM_HOOK_SHADOW and DM_HQ_LIGHT_PASS
82
RE_Light
*
light
;
83
84
// In case this is registered more than once to different spots, this
85
// allows the hook to differentiate the callers.
86
DM_SceneHookType
hook_type
;
87
DM_SceneHookPolicy
hook_policy
;
88
89
// For picking, what is being requested for picking
90
// (GR_PICK_* in GR_PickRecord.h)
91
int
pick_type
;
92
93
// Frustum culling picks only
94
UT_DimRect
pick_area
;
95
const
uint8
*
pick_mask
;
96
};
97
98
99
100
/// Scene render hook instance, which does the actual rendering for a viewport
101
class
DM_API
DM_SceneRenderHook
102
{
103
public
:
104
/// A Scene render hook has a parent viewport and a view type mask which
105
/// determines which viewport types it will display in (eg. perspective,
106
/// ortho, UV, all). The viewer_scope determines which viewer type it will
107
/// appear in (Obj/Sop/Dop, or Lop).
108
DM_SceneRenderHook
(
DM_VPortAgent
&vport,
109
DM_ViewportType
view_mask);
110
virtual
~
DM_SceneRenderHook
();
111
112
/// @brief Restrict hook to only certain Viewport Renderer versions
113
/// This method allows you to restrict this hook to only operate in some of
114
/// the viewport renderers (H11 - GL3). If the viewport is set to a
115
/// a renderer and this method returns false, it will be skipped. The
116
/// default action is to support all viewport renderers.
117
virtual
bool
supportsRenderer
(
GR_RenderVersion
version
)
118
{
return
true
; }
119
120
/// @brief Render method called when the rendering task is required.
121
/// render() performs the rendering task for the hook, or returns false if
122
/// if it cannot. The RE_Render contains the active GL context and the
123
/// hook_data contains viewport-specific and hook-specific data.
124
virtual
bool
render
(
RE_RenderContext
r
,
125
const
DM_SceneHookData
&hook_data) = 0;
126
127
/// @brief Callback method when the viewport is no longer visible.
128
/// Called when the viewport is temporarily closed (quad/single switch, pane
129
/// switch). This gives the hook the opportunity to clean up expensive GL
130
/// objects or caches.
131
virtual
void
viewportClosed();
132
133
/// For hooks that register with DM_HOOK_FRAMEBUFFER_PICK, this reports the
134
/// selection back to the hook once it is complete.
135
/// only picks for this hook are returned, and this may be an empty list.
136
virtual
void
selectionResult(
const
UT_Array<GR_PickRecord>
&
selection
);
137
138
/// Viewport this scene render is attached to.
139
DM_VPortAgent
&
viewport
()
const
{
return
myAgent; }
140
DM_ViewportType
getViewportMask
()
const
{
return
myViewportMask; }
141
int
getID
()
const
{
return
myID; }
142
143
/// Get the currently displayed LOP (LOP hook specific)
144
const
OP_Node
*getDisplayLOP()
const
;
145
146
/// Get the current LOP, the LOP that is displaying handles and in the parm
147
/// dialog (LOP hook specific)
148
const
OP_Node
*getCurrentLOP()
const
;
149
private
:
150
DM_VPortAgent
&myAgent;
151
DM_ViewportType
myViewportMask;
152
int
myID;
153
};
154
155
156
157
/// A Scene Hook creates new scene render hooks when new viewports are created.
158
class
DM_API
DM_SceneHook
159
{
160
public
:
161
/// Create a scene hook which creates scene render hook instances for
162
/// specific viewports. Only one scene hook is ever created, and it is
163
/// responsible for managing the scene render hooks for viewports.
164
/// Each hook requires a name (for error reporting) and a priority level
165
/// to resolve multiple scene hook conflicts.
166
DM_SceneHook
(
const
char
*hook_name,
167
int
priority,
168
DM_SceneHookScope
viewer_scope);
169
virtual
~
DM_SceneHook
();
170
171
const
char
*
getName
()
const
{
return
myHookName; }
172
int
getPriority
()
const
{
return
myPriority; }
173
DM_SceneHookScope
getViewerScope
()
const
{
return
myViewerScope; }
174
175
/// @brief Called when a viewport needs to create a new hook.
176
/// Each viewport has its own scene hook.
177
virtual
DM_SceneRenderHook
*newSceneRender(
DM_VPortAgent
&vport,
178
DM_SceneHookType
type
,
179
DM_SceneHookPolicy
policy) = 0;
180
181
/// @brief Called when a viewport no longer requires the hook.
182
/// When a viewport is destroyed, it retires all its hooks. Because a hook
183
/// could be shared between all viewports, this method gives the scene hook
184
/// the opportunity to delete it, dereference it, etc. The viewport doing
185
/// the retiring is passed in along with the hook it is retiring.
186
virtual
void
retireSceneRender(
DM_VPortAgent
&vport,
187
DM_SceneRenderHook
*hook) = 0;
188
189
private
:
190
UT_String
myHookName;
191
int
myPriority;
192
DM_SceneHookScope
myViewerScope;
193
};
194
#endif
DM_SceneRenderHook::supportsRenderer
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:117
RE_RenderContext.h
GT_Names::selection
GT_API const UT_StringHolder selection
DM_HOOK_ALL_VIEWS
Definition:
DM_SceneHook.h:67
GR_PickRecord.h
DM_SceneRenderHook
Scene render hook instance, which does the actual rendering for a viewport.
Definition:
DM_SceneHook.h:101
DM_HOOK_PRE_RENDER
Definition:
DM_SceneHook.h:35
DM_SceneRenderHook::getViewportMask
DM_ViewportType getViewportMask() const
Definition:
DM_SceneHook.h:140
DM_HOOK_POST_RENDER
Definition:
DM_SceneHook.h:40
UT_Rect.h
DM_SceneHookScope
DM_SceneHookScope
Definition:
DM_SceneHook.h:62
GR_Defines.h
DM_HOOK_HQ_LIGHT_PASS
Definition:
DM_SceneHook.h:45
GUI_DisplayOption
Definition:
GUI_DisplayOption.h:65
DM_HOOK_SHADOW
Definition:
DM_SceneHook.h:44
DM_HOOK_FRAMEBUFFER_PICK
Definition:
DM_SceneHook.h:48
RE_Light
Definition:
RE_Light.h:98
DM_SceneRenderHook::getID
int getID() const
Definition:
DM_SceneHook.h:141
UT_Array< GR_PickRecord >
RE_RenderContext
Temporary container for either a RV_Render and an RE_Render.
Definition:
RE_RenderContext.h:23
render
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
Definition:
HDK_Image.dox:266
DM_SceneHookData::disp_options
const GUI_DisplayOption * disp_options
Definition:
DM_SceneHook.h:75
DM_API
#define DM_API
Definition:
DM_API.h:10
uint8
unsigned char uint8
Definition:
SYS_Types.h:36
UT_String.h
type
GLint GLint GLsizei GLint GLenum GLenum type
Definition:
glcorearb.h:108
DM_SceneHookData::pick_area
UT_DimRect pick_area
Definition:
DM_SceneHook.h:94
DM_HOOK_FOREGROUND
Definition:
DM_SceneHook.h:41
DM_HOOK_BACKGROUND
Definition:
DM_SceneHook.h:34
DM_SceneHookType
DM_SceneHookType
The rendering task that the hook performs.
Definition:
DM_SceneHook.h:32
OP_Node
Definition:
OP_Node.h:528
DM_HOOK_BEAUTY
Definition:
DM_SceneHook.h:36
DM_SceneHook::getPriority
int getPriority() const
Definition:
DM_SceneHook.h:172
DM_SceneHookData
Data structure for rendering scene hooks.
Definition:
DM_SceneHook.h:71
DM_HOOK_REPLACE_NATIVE
Definition:
DM_SceneHook.h:57
RE_Render
Definition:
RE_Render.h:29
DM_HOOK_FULL_SCENE
Definition:
DM_SceneHook.h:51
DM_SceneHook::getViewerScope
DM_SceneHookScope getViewerScope() const
Definition:
DM_SceneHook.h:173
DM_HOOK_XRAY
Definition:
DM_SceneHook.h:39
DM_SceneHookData::light
RE_Light * light
Definition:
DM_SceneHook.h:82
GR_RenderVersion
GR_RenderVersion
Definition:
GR_Defines.h:22
GT_Names::version
GT_API const UT_StringHolder version
DM_VPortAgent
Definition:
DM_VPortAgent.h:73
DM_SceneHook
A Scene Hook creates new scene render hooks when new viewports are created.
Definition:
DM_SceneHook.h:158
DM_HOOK_UNLIT
Definition:
DM_SceneHook.h:38
DM_SceneHook::getName
const char * getName() const
Definition:
DM_SceneHook.h:171
UT_Rect< UT_DimRectImpl >
DM_HOOK_BEAUTY_TRANSPARENT
Definition:
DM_SceneHook.h:37
DM_HOOK_OBJSOPDOP_VIEW
Definition:
DM_SceneHook.h:64
UT_String
Definition:
UT_String.h:76
DM_SceneHookData::hook_policy
DM_SceneHookPolicy hook_policy
Definition:
DM_SceneHook.h:87
r
GLboolean r
Definition:
glcorearb.h:1222
DM_SceneHookPolicy
DM_SceneHookPolicy
How the hook augments or replaces the native Houdini rendering task.
Definition:
DM_SceneHook.h:55
DM_HOOK_FRUSTUM_PICK
Definition:
DM_SceneHook.h:49
DM_ViewportType.h
DM_SceneHookData::hook_type
DM_SceneHookType hook_type
Definition:
DM_SceneHook.h:86
DM_ViewportType
int DM_ViewportType
Definition:
DM_ViewportType.h:32
DM_HOOK_AFTER_NATIVE
Definition:
DM_SceneHook.h:59
DM_SceneHookData::pick_type
int pick_type
Definition:
DM_SceneHook.h:91
DM_SceneHookData::view_height
int view_height
Definition:
DM_SceneHook.h:79
DM_SceneRenderHook::viewport
DM_VPortAgent & viewport() const
Viewport this scene render is attached to.
Definition:
DM_SceneHook.h:139
DM_SceneHookData::view_width
int view_width
Definition:
DM_SceneHook.h:78
DM_HOOK_LOP_VIEW
Definition:
DM_SceneHook.h:65
DM_SceneHookData::pick_mask
const uint8 * pick_mask
Definition:
DM_SceneHook.h:95
DM_API.h
DM_HOOK_BEFORE_NATIVE
Definition:
DM_SceneHook.h:58
DM
DM_SceneHook.h
Generated on Mon Aug 17 2026 02:15:21 for HDK by
1.8.6