Panda3D
|
A node that contains a plane. More...
#include "planeNode.h"
Classes | |
class | CData |
Public Types | |
enum | ClipEffect { CE_visible = 0x0001, CE_collision = 0x0002 } |
Public Member Functions | |
PlaneNode (const string &name, const LPlane &plane=LPlane()) | |
virtual bool | cull_callback (CullTraverser *trav, CullTraverserData &data) |
This function will be called during the cull traversal to perform any additional operations that should be performed at cull time. | |
virtual TypeHandle | force_init_type () |
int | get_clip_effect () const |
Returns the clip_effect bits for this clip plane. | |
const LPlane & | get_plane () const |
Returns the plane represented by the PlaneNode. | |
int | get_priority () const |
Returns the priority associated with this clip plane. | |
virtual TypeHandle | get_type () const |
PN_stdfloat | get_viz_scale () const |
Returns the size of the visual representation of the plane that is drawn if the PlaneNode is shown. | |
virtual bool | is_renderable () const |
Returns true if there is some value to visiting this particular node during the cull traversal for any camera, false otherwise. | |
virtual PandaNode * | make_copy () const |
Returns a newly-allocated Node that is a shallow copy of this one. | |
virtual void | output (ostream &out) const |
Outputs the Namable. | |
void | set_clip_effect (int clip_effect) |
Specifies the sort of things this plane will actually clip (when it is used as a clip plane). | |
void | set_plane (const LPlane &plane) |
Sets the particular plane represented by the PlaneNode. | |
void | set_priority (int priority) |
Changes the relative importance of this PlaneNode (when it is used as a clip plane) relative to the other clip planes that are applied simultaneously. | |
void | set_viz_scale (PN_stdfloat viz_scale) |
Specifies the size of the visual representation of the plane that is drawn if the PlaneNode is shown. | |
virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. | |
virtual void | xform (const LMatrix4 &mat) |
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static UpdateSeq | get_sort_seq () |
Returns a global sequence number that is incremented any time any PlaneNode in the world changes sort or priority. | |
static void | init_type () |
static void | register_with_read_factory () |
Tells the BamReader how to create objects of type PlaneNode. | |
Protected Member Functions | |
PlaneNode (const PlaneNode ©) | |
virtual void | compute_internal_bounds (CPT(BoundingVolume)&internal_bounds, int &internal_vertices, int pipeline_stage, Thread *current_thread) const |
Returns a newly-allocated BoundingVolume that represents the internal contents of the node. | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new PlaneNode. | |
PT (Geom) get_viz(CullTraverser *trav | |
Static Protected Member Functions | |
static TypedWritable * | make_from_bam (const FactoryParams ¶ms) |
This function is called by the BamReader's factory when a new object of type PlaneNode is encountered in the Bam file. | |
Protected Attributes | |
CullTraverserData & | data |
A node that contains a plane.
This is most often used as a clipping plane, but it can serve other purposes as well; whenever a plane is needed to be defined in some coordinate space in the world.
Definition at line 39 of file planeNode.h.
void PlaneNode::compute_internal_bounds | ( | CPT(BoundingVolume)& | internal_bounds, |
int & | internal_vertices, | ||
int | pipeline_stage, | ||
Thread * | current_thread | ||
) | const [protected, virtual] |
Returns a newly-allocated BoundingVolume that represents the internal contents of the node.
Should be overridden by PandaNode classes that contain something internally.
Reimplemented from PandaNode.
Definition at line 204 of file planeNode.cxx.
bool PlaneNode::cull_callback | ( | CullTraverser * | trav, |
CullTraverserData & | data | ||
) | [virtual] |
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 165 of file planeNode.cxx.
References CullTraverser::get_cull_handler(), CullTraverser::get_gsg(), CullTraverserData::get_net_transform(), and CullHandler::record_object().
void PlaneNode::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected, virtual] |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new PlaneNode.
Reimplemented from PandaNode.
Definition at line 352 of file planeNode.cxx.
References BamReader::get_file_minor_ver(), DatagramIterator::get_int32(), DatagramIterator::get_uint8(), and BamReader::read_cdata().
Referenced by make_from_bam().
int PlaneNode::get_clip_effect | ( | ) | const [inline] |
Returns the clip_effect bits for this clip plane.
See set_clip_effect().
Definition at line 157 of file planeNode.I.
Referenced by CollisionBox::apply_clip_plane().
const LPlane & PlaneNode::get_plane | ( | ) | const [inline] |
Returns the plane represented by the PlaneNode.
Definition at line 65 of file planeNode.I.
Referenced by CollisionBox::apply_clip_plane(), DXGraphicsStateGuardian8::bind_clip_plane(), DXGraphicsStateGuardian9::bind_clip_plane(), and output().
int PlaneNode::get_priority | ( | ) | const [inline] |
Returns the priority associated with this clip plane.
See set_priority().
Definition at line 129 of file planeNode.I.
UpdateSeq PlaneNode::get_sort_seq | ( | ) | [inline, static] |
Returns a global sequence number that is incremented any time any PlaneNode in the world changes sort or priority.
This is used by ClipPlaneAttrib to determine when it is necessary to re-sort its internal array of stages.
Definition at line 171 of file planeNode.I.
PN_stdfloat PlaneNode::get_viz_scale | ( | ) | const [inline] |
Returns the size of the visual representation of the plane that is drawn if the PlaneNode is shown.
Definition at line 93 of file planeNode.I.
bool PlaneNode::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 191 of file planeNode.cxx.
PandaNode * PlaneNode::make_copy | ( | ) | const [virtual] |
TypedWritable * PlaneNode::make_from_bam | ( | const FactoryParams & | params | ) | [static, protected] |
This function is called by the BamReader's factory when a new object of type PlaneNode is encountered in the Bam file.
It should create the PlaneNode and extract its information from the file.
Reimplemented from PandaNode.
Definition at line 333 of file planeNode.cxx.
References fillin().
Referenced by register_with_read_factory().
void PlaneNode::output | ( | ostream & | out | ) | const [virtual] |
Outputs the Namable.
This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.
Reimplemented from PandaNode.
Definition at line 105 of file planeNode.cxx.
References get_plane().
void PlaneNode::register_with_read_factory | ( | ) | [static] |
Tells the BamReader how to create objects of type PlaneNode.
Reimplemented from PandaNode.
Definition at line 306 of file planeNode.cxx.
References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().
void PlaneNode::set_clip_effect | ( | int | clip_effect | ) | [inline] |
Specifies the sort of things this plane will actually clip (when it is used as a clip plane).
This is a bitmask union of ClipEffect values. If it includes CE_visible, then it will clip visible geometry; if it includes CE_collision, then it will clip collision polygons. If it includes neither bit, it will still affect culling, but objects will either be wholly behind the clipping plane, or wholly present.
Definition at line 146 of file planeNode.I.
void PlaneNode::set_plane | ( | const LPlane & | plane | ) | [inline] |
Sets the particular plane represented by the PlaneNode.
Definition at line 50 of file planeNode.I.
void PlaneNode::set_priority | ( | int | priority | ) | [inline] |
Changes the relative importance of this PlaneNode (when it is used as a clip plane) relative to the other clip planes that are applied simultaneously.
The priority number is used to decide which of the requested clip planes are to be activated when more clip planes are requested than the hardware will support. The highest-priority n planes are selected for rendering.
This is similar to TextureStage::set_priority().
Definition at line 114 of file planeNode.I.
void PlaneNode::set_viz_scale | ( | PN_stdfloat | viz_scale | ) | [inline] |
Specifies the size of the visual representation of the plane that is drawn if the PlaneNode is shown.
Definition at line 77 of file planeNode.I.
void PlaneNode::write_datagram | ( | BamWriter * | manager, |
Datagram & | dg | ||
) | [virtual] |
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented from PandaNode.
Definition at line 317 of file planeNode.cxx.
References Datagram::add_int32(), Datagram::add_uint8(), and BamWriter::write_cdata().
void PlaneNode::xform | ( | const LMatrix4 & | mat | ) | [virtual] |
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
For most kinds of PandaNodes, this does nothing.
Reimplemented from PandaNode.
Definition at line 131 of file planeNode.cxx.