This class draws a visible representation of the NURBS surface stored in its NurbsSurfaceEvaluator. More...

#include "sheetNode.h"

Inheritance diagram for SheetNode:
PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase MemoryBase

List of all members.

Classes

class  CData

Public Member Functions

 SheetNode (const string &name)
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_num_u_subdiv () const
 Returns the number of subdivisions per cubic segment to draw in the U direction.
int get_num_v_subdiv () const
 Returns the number of subdivisions per cubic segment to draw in the V direction.
NurbsSurfaceEvaluatorget_surface () const
 Returns the surface represented by the SheetNode.
virtual TypeHandle get_type () const
bool get_use_vertex_color () const
 Returns the "use vertex color" flag.
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 PandaNodemake_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 reset_bound (const NodePath &rel_to)
 Recomputes the bounding volume.
virtual bool safe_to_transform () const
 Returns true if it is generally safe to transform this particular kind of Node by calling the xform() method, false otherwise.
void set_num_u_subdiv (int num_u_subdiv)
 Specifies the number of subdivisions per cubic segment (that is, per unique knot value) to draw in a fixed uniform tesselation of the surface in the U direction.
void set_num_v_subdiv (int num_v_subdiv)
 Specifies the number of subdivisions per cubic segment (that is, per unique knot value) to draw in a fixed uniform tesselation of the surface in the V direction.
void set_surface (NurbsSurfaceEvaluator *surface)
 Sets the particular surface represented by the SheetNode.
void set_use_vertex_color (bool flag)
 Sets the "use vertex color" flag.
virtual void write (ostream &out, int indent_level=0) const
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type SheetNode.

Detailed Description

This class draws a visible representation of the NURBS surface stored in its NurbsSurfaceEvaluator.

It automatically recomputes the surface every frame.

This is not related to NurbsSurface, CubicSurfaceseg or any of the ParametricSurface-derived objects in this module. It is a completely parallel implementation of NURBS surfaces, and will probably eventually replace the whole ParametricSurface class hierarchy.

Definition at line 36 of file sheetNode.h.


Member Function Documentation

bool SheetNode::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 149 of file sheetNode.cxx.

References WorkingNodePath::get_node_path(), get_num_u_subdiv(), get_num_v_subdiv(), and get_surface().

int SheetNode::get_num_u_subdiv ( ) const [inline]

Returns the number of subdivisions per cubic segment to draw in the U direction.

See set_num_u_subdiv().

Definition at line 116 of file sheetNode.I.

Referenced by cull_callback().

int SheetNode::get_num_v_subdiv ( ) const [inline]

Returns the number of subdivisions per cubic segment to draw in the V direction.

See set_num_v_subdiv().

Definition at line 143 of file sheetNode.I.

Referenced by cull_callback().

Returns the surface represented by the SheetNode.

Definition at line 61 of file sheetNode.I.

Referenced by cull_callback(), and output().

bool SheetNode::get_use_vertex_color ( ) const [inline]

Returns the "use vertex color" flag.

See set_use_vertex_color().

Definition at line 89 of file sheetNode.I.

bool SheetNode::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 179 of file sheetNode.cxx.

PandaNode * SheetNode::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 106 of file sheetNode.cxx.

void SheetNode::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 189 of file sheetNode.cxx.

References get_surface().

Tells the BamReader how to create objects of type SheetNode.

Reimplemented from PandaNode.

Definition at line 391 of file sheetNode.cxx.

References BamReader::get_factory(), and Factory< Type >::register_factory().

void SheetNode::reset_bound ( const NodePath rel_to)

Recomputes the bounding volume.

This is normally called automatically, but it must occasionally be called explicitly when the surface has changed properties outside of this node's knowledge.

Definition at line 224 of file sheetNode.cxx.

References Thread::get_current_thread(), Thread::get_pipeline_stage(), and PandaNode::mark_internal_bounds_stale().

bool SheetNode::safe_to_transform ( ) const [virtual]

Returns true if it is generally safe to transform this particular kind of Node by calling the xform() method, false otherwise.

For instance, it's usually a bad idea to attempt to xform a SheetNode.

Reimplemented from PandaNode.

Definition at line 119 of file sheetNode.cxx.

void SheetNode::set_num_u_subdiv ( int  num_u_subdiv) [inline]

Specifies the number of subdivisions per cubic segment (that is, per unique knot value) to draw in a fixed uniform tesselation of the surface in the U direction.

Definition at line 103 of file sheetNode.I.

void SheetNode::set_num_v_subdiv ( int  num_v_subdiv) [inline]

Specifies the number of subdivisions per cubic segment (that is, per unique knot value) to draw in a fixed uniform tesselation of the surface in the V direction.

Definition at line 130 of file sheetNode.I.

void SheetNode::set_surface ( NurbsSurfaceEvaluator surface) [inline]

Sets the particular surface represented by the SheetNode.

Definition at line 50 of file sheetNode.I.

void SheetNode::set_use_vertex_color ( bool  flag) [inline]

Sets the "use vertex color" flag.

When this is true, the R, G, B, A vertex color is assumed to be stored as the dimensions 0, 1, 2, 3, respectively, of the extended vertex values. Use NurbsCurveEvaluator::set_extended_vertex() to set these values.

Definition at line 77 of file sheetNode.I.

void SheetNode::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 402 of file sheetNode.cxx.

References BamWriter::write_cdata().


The documentation for this class was generated from the following files: