|
|
|
A special node that can issue arbitrary callbacks to user code, either during the cull or draw traversals.
More...
#include "callbackNode.h"
List of all members.
Detailed Description
A special node that can issue arbitrary callbacks to user code, either during the cull or draw traversals.
Definition at line 28 of file callbackNode.h.
Member Function Documentation
| void CallbackNode::clear_cull_callback |
( |
| ) |
[inline] |
| void CallbackNode::clear_draw_callback |
( |
| ) |
[inline] |
This function will be called during the cull traversal to perform any additional operations that should be performed at cull time.
This may include additional manipulation of render state or additional visible/invisible decisions, or any other arbitrary operation.
Note that this function will *not* be called unless set_cull_callback() is called in the constructor of the derived class. It is necessary to call set_cull_callback() to indicated that we require cull_callback() to be called.
By the time this function is called, the node has already passed the bounding-volume test for the viewing frustum, and the node's transform and state have already been applied to the indicated CullTraverserData object.
The return value is true if this node should be visible, or false if it should be culled.
Reimplemented from PandaNode.
Definition at line 110 of file callbackNode.cxx.
References CallbackObject::do_callback(), and get_cull_callback().
| bool CallbackNode::is_renderable |
( |
| ) |
const [virtual] |
Returns true if there is some value to visiting this particular node during the cull traversal for any camera, false otherwise.
This will be used to optimize the result of get_net_draw_show_mask(), so that any subtrees that contain only nodes for which is_renderable() is false need not be visited.
Reimplemented from PandaNode.
Definition at line 135 of file callbackNode.cxx.
| PandaNode * CallbackNode::make_copy |
( |
| ) |
const [virtual] |
Returns a newly-allocated Node that is a shallow copy of this one.
It will be a different Node pointer, but its internal data may or may not be shared with that of the original Node.
Reimplemented from PandaNode.
Definition at line 65 of file callbackNode.cxx.
| void CallbackNode::output |
( |
ostream & |
out | ) |
const [virtual] |
Writes a brief description of the node to the indicated output stream.
This is invoked by the << operator. It may be overridden in derived classes to include some information relevant to the class.
Reimplemented from PandaNode.
Definition at line 173 of file callbackNode.cxx.
| void CallbackNode::register_with_read_factory |
( |
| ) |
[static] |
| bool CallbackNode::safe_to_combine |
( |
| ) |
const [virtual] |
Returns true if it is generally safe to combine this particular kind of PandaNode with other kinds of PandaNodes of compatible type, adding children or whatever.
For instance, an LODNode should not be combined with any other PandaNode, because its set of children is meaningful.
Reimplemented from PandaNode.
Definition at line 80 of file callbackNode.cxx.
| void CallbackNode::set_cull_callback |
( |
CallbackObject * |
object | ) |
[inline] |
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.
Definition at line 47 of file callbackNode.I.
| void CallbackNode::set_draw_callback |
( |
CallbackObject * |
object | ) |
[inline] |
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.
Definition at line 102 of file callbackNode.I.
Referenced by clear_draw_callback().
The documentation for this class was generated from the following files:
| | |