forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallbackNode.I
More file actions
116 lines (108 loc) · 3.57 KB
/
callbackNode.I
File metadata and controls
116 lines (108 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file callbackNode.I
* @author drose
* @date 2009-03-13
*/
/**
* Sets the CallbackObject that will be notified when this node is visited
* during the cull traversal. This callback will be made during the cull
* thread.
*
* The cull traversal is responsible for determining which nodes are visible
* and within the view frustum, and for accumulating state and transform, and
* generally building up the list of CullableObjects that are to be eventually
* passed to the draw traversal for rendering.
*
* At the time the cull traversal callback is made, the node has been
* determined to be visible and it has passed the bounding-volume test, so it
* lies within the view frustum.
*
* The callback is passed an instance of a NodeCullCallbackData, which
* contains pointers to the CullTraverser and CullTraverserData--enough data
* to examine the current node and its place within the scene graph. The
* callback *replaces* the normal cull behavior, so if your callback does
* nothing, the cull traversal will not continue below this node. If you wish
* the cull traversal to continue to visit this node and below, you must call
* cbdata->upcall() from your callback.
*/
INLINE void CallbackNode::
set_cull_callback(CallbackObject *object) {
CDWriter cdata(_cycler);
cdata->_cull_callback = object;
}
/**
* Removes the callback set by an earlier call to set_cull_callback().
*/
INLINE void CallbackNode::
clear_cull_callback() {
set_cull_callback(nullptr);
}
/**
* Returns the CallbackObject set by set_cull_callback().
*/
INLINE CallbackObject *CallbackNode::
get_cull_callback() const {
CDReader cdata(_cycler);
return cdata->_cull_callback;
}
/**
* Sets the CallbackObject that will be notified when this node is visited
* during the draw traversal. This callback will be made during the draw
* thread.
*
* The draw traversal is responsible for actually issuing the commands to the
* graphics engine to draw primitives. Its job is to walk through the list of
* CullableObjects build up by the cull traversal, as quickly as possible,
* issuing the appropriate commands to draw each one.
*
* At the time the draw traversal callback is made, the graphics state has
* been loaded with the correct modelview transform and render state, and the
* primitives (if any) in this node are ready to be drawn.
*
* The callback is passed an instance of a GeomDrawCallbackData, which
* contains pointers to the current state and transform, as well as the
* current GSG. There is a Geom pointer as well, but it will always be NULL
* to this callback, since the CallbackNode does not itself contain any Geoms.
*/
INLINE void CallbackNode::
set_draw_callback(CallbackObject *object) {
CDWriter cdata(_cycler);
cdata->_draw_callback = object;
}
/**
* Removes the callback set by an earlier call to set_draw_callback().
*/
INLINE void CallbackNode::
clear_draw_callback() {
set_draw_callback(nullptr);
}
/**
* Returns the CallbackObject set by set_draw_callback().
*/
INLINE CallbackObject *CallbackNode::
get_draw_callback() const {
CDReader cdata(_cycler);
return cdata->_draw_callback;
}
/**
*
*/
INLINE CallbackNode::CData::
CData() {
}
/**
*
*/
INLINE CallbackNode::CData::
CData(const CallbackNode::CData ©) :
_cull_callback(copy._cull_callback),
_draw_callback(copy._draw_callback)
{
}