PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. More...
#include "pandaNode.h"
#include "config_pgraph.h"
#include "nodePathComponent.h"
#include "bamReader.h"
#include "bamWriter.h"
#include "indent.h"
#include "geometricBoundingVolume.h"
#include "sceneGraphReducer.h"
#include "accumulatedAttribs.h"
#include "clipPlaneAttrib.h"
#include "boundingSphere.h"
#include "boundingBox.h"
#include "pStatTimer.h"
#include "config_mathutil.h"
#include "lightReMutexHolder.h"
#include "graphicsStateGuardianBase.h"
Go to the source code of this file.
Functions | |
CPT (TransformState) PandaNode | |
This is used to support NodePath::calc_tight_bounds(). More... | |
CPT (RenderAttrib) PandaNode | |
Returns a ClipPlaneAttrib which represents the union of all of the clip planes that have been turned *off* at this level and below. More... | |
CPT (BoundingVolume) PandaNode | |
Returns the external bounding volume of this node: a bounding volume that contains the user bounding volume, the internal bounding volume, and all of the children's bounding volumes. More... | |
NotifyCategoryDecl (drawmask, EXPCL_PANDA_PGRAPH, EXPTP_PANDA_PGRAPH) | |
NotifyCategoryDef (drawmask, "") | |
PT (PandaNode) PandaNode | |
Allocates and returns a complete copy of this PandaNode and the entire scene graph rooted at this PandaNode. More... | |
PT (NodePathComponent) PandaNode | |
Creates a new parent-child relationship, and returns the new NodePathComponent. More... | |
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."
Definition in file pandaNode.cxx.
CPT | ( | TransformState | ) |
This is used to support NodePath::calc_tight_bounds().
It is not intended to be called directly, and it has nothing to do with the normal Panda bounding-volume computation.
If the node contains any geometry, this updates min_point and max_point to enclose its bounding box. found_any is to be set true if the node has any geometry at all, or left alone if it has none. This method may be called over several nodes, so it may enter with min_point, max_point, and found_any already set.
This function is recursive, and the return value is the transform after it has been modified by this node's transform. 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.
Definition at line 357 of file pandaNode.cxx.
References PandaNode::get_children.
CPT | ( | RenderAttrib | ) |
Returns a ClipPlaneAttrib which represents the union of all of the clip planes that have been turned *off* at this level and below.
Walks through the scene graph beginning at this node, and does whatever initialization is required to render the scene properly with the indicated GSG. It is not strictly necessary to call this, since the GSG will initialize itself when the scene is rendered, but this may take some of the overhead away from that process.
In particular, this will ensure that textures and vertex buffers within the scene are loaded into graphics memory.
Definition at line 1738 of file pandaNode.cxx.
References Thread::get_pipeline_stage.
CPT | ( | BoundingVolume | ) |
Returns the external bounding volume of this node: a bounding volume that contains the user bounding volume, the internal bounding volume, and all of the children's bounding volumes.
Returns the node's internal bounding volume.
This flavor of get_bounds() return the external bounding volume, and also fills in seq with the bounding volume's current sequence number. When this sequence number changes, it indicates that the bounding volume might have changed, e.g. because some nested child's bounding volume has changed.
Although this might occasionally increment without changing the bounding volume, the bounding volume will never change without incrementing this counter, so as long as this counter remains unchanged you can be confident the bounding volume is also unchanged. Returns the total number of vertices that will be rendered by this node and all of its descendents.
This is not necessarily an accurate count of vertices that will actually be rendered, since this will include all vertices of all LOD's, and it will also include hidden nodes. It may also omit or only approximate certain kinds of dynamic geometry. However, it will not include stashed nodes. Indicates that the bounding volume, or something that influences the bounding volume (or any of the other things stored in CData, like net_collide_mask), may have changed for this node, and that it must be recomputed.
With no parameters, this means to iterate through all stages including and upstream of the current pipeline stage.
This method is intended for internal use; usually it is not necessary for a user to call this directly. It will be called automatically by derived classes when appropriate. Should be called by a derived class to mark the internal bounding volume stale, so that compute_internal_bounds() will be called when the bounding volume is next requested.
With no parameters, this means to iterate through all stages including and upstream of the current pipeline stage.
It is normally not necessary to call this method directly; each node should be responsible for calling it when its internals have changed.
This is the bounding volume around the node alone, without including children. Returns the total number of vertices that will be rendered by this particular node alone, not accounting for its children.
This may not include all vertices for certain dynamic effects. This is provided as an alternate way for a node to set its own internal bounds, rather than overloading compute_internal_bounds(). If this method is called, the internal bounding volume will immediately be set to the indicated pointer.
Definition at line 1943 of file pandaNode.cxx.
References Thread::get_pipeline_stage.
PT | ( | PandaNode | ) |
Allocates and returns a complete copy of this PandaNode and the entire scene graph rooted at this PandaNode.
This is the recursive implementation of copy_subgraph().
Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on those bytes.
Some data may still be shared from the original (e.g. vertex index tables), but nothing that will impede normal use of the PandaNode. Returns the number of nodes at and below this level. Adds a new child to the node. The child is added in the relative position indicated by sort; if all children have the same sort index, the child is added at the end.
If the same child is added to a node more than once, the previous instance is first removed.
Returns NULL on error.
This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type PandaNode, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.
It returns a copy of the entire subgraph rooted at this node.
Note that it includes the parameter inst_map, which is a map type, and is not (and cannot be) exported from PANDA.DLL. Thus, any derivative of PandaNode that is not also a member of PANDA.DLL *cannot* access this map. This is called by r_copy_subgraph(); the copy has already been made of this particular node (and this is the copy); this function's job is to copy all of the children from the original.
Note that it includes the parameter inst_map, which is a map type, and is not (and cannot be) exported from PANDA.DLL. Thus, any derivative of PandaNode that is not also a member of PANDA.DLL *cannot* access this map, and probably should not even override this function.
Definition at line 497 of file pandaNode.cxx.
PT | ( | NodePathComponent | ) |
Creates a new parent-child relationship, and returns the new NodePathComponent.
The recursive implementation of get_generic_component, this simply sets the flag when the ambiguity is detected (so we can report the bottom node that started the ambiguous search).
Returns a NodePathComponent referencing this node as a path from the root.
Returns a NodePathComponent referencing the indicated node as a singleton.
Returns the NodePathComponent based on the indicated child of the given parent, or NULL if there is no such parent-child relationship.
If the child was already attached to the indicated parent, repositions it and returns the original NodePathComponent.
This operation is automatically propagated back up to pipeline 0, from the specified pipeline stage.
It is invalid to call this for a node that has parents, unless you are about to create a new instance (and immediately reconnect the NodePathComponent elsewhere).
If force is true, this will always return something, even if it needs to create a new top component; otherwise, if force is false, it will return NULL if there is not already a top component available.
Unless accept_ambiguity is true, it is only valid to call this if there is an unambiguous path from the root; otherwise, a warning will be issued and one path will be chosen arbitrarily.
Definition at line 2675 of file pandaNode.cxx.