Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions

ClipPlaneAttrib Class Reference

This functions similarly to a LightAttrib. More...

#include "clipPlaneAttrib.h"

Inheritance diagram for ClipPlaneAttrib:
RenderAttrib TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Types

enum  Operation { O_set, O_add, O_remove }

Public Member Functions

virtual int complete_pointers (TypedWritable **plist, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
 CPT (RenderAttrib) add_on_plane(const NodePath &plane) const
 CPT (RenderAttrib) remove_on_plane(const NodePath &plane) const
 CPT (RenderAttrib) add_off_plane(const NodePath &plane) const
 CPT (RenderAttrib) remove_off_plane(const NodePath &plane) const
 CPT (ClipPlaneAttrib) filter_to_max(int max_clip_planes) const
 CPT (RenderAttrib) compose_off(const RenderAttrib *other) const
 CPT (RenderAttrib) add_plane(PlaneNode *plane) const
 CPT (RenderAttrib) remove_plane(PlaneNode *plane) const
virtual TypeHandle force_init_type ()
int get_num_off_planes () const
 Returns the number of planes that are disabled by the attribute.
int get_num_on_planes () const
 Returns the number of planes that are enabled by the attribute.
int get_num_planes () const
 Returns the number of planes listed in the attribute.
NodePath get_off_plane (int n) const
 Returns the nth plane disabled by the attribute, sorted in arbitrary (pointer) order.
NodePath get_on_plane (int n) const
 Returns the nth plane enabled by the attribute, sorted in render order.
Operation get_operation () const
 Returns the basic operation type of the ClipPlaneAttrib.
PlaneNodeget_plane (int n) const
 Returns the nth plane listed in the attribute.
virtual int get_slot () const
virtual TypeHandle get_type () const
bool has_all_off () const
 Returns true if this attrib disables all planes (although it may also enable some).
bool has_off_plane (const NodePath &plane) const
 Returns true if the indicated plane is disabled by the attrib, false otherwise.
bool has_on_plane (const NodePath &plane) const
 Returns true if the indicated plane is enabled by the attrib, false otherwise.
bool has_plane (PlaneNode *plane) const
 Returns true if the indicated plane is listed in the attrib, false otherwise.
bool is_identity () const
 Returns true if this is an identity attrib: it does not change the set of planes in use.
 MAKE_SEQ (get_off_planes, get_num_off_planes, get_off_plane)
 MAKE_SEQ (get_on_planes, get_num_on_planes, get_on_plane)
virtual void output (ostream &out) const
virtual bool require_fully_complete () const
 Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.
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 CPT (RenderAttrib) make(Operation op
static CPT (RenderAttrib) make(Operation op
static CPT (RenderAttrib) make(Operation op
static CPT (RenderAttrib) make_default()
static CPT (RenderAttrib) make(Operation op
static CPT (RenderAttrib) make_all_off()
static CPT (RenderAttrib) make()
static int get_class_slot ()
static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type ClipPlaneAttrib.

Public Attributes

static PlaneNodeplane
static PlaneNodeplane1
static PlaneNode PlaneNodeplane2
static PlaneNode PlaneNode
PlaneNode
plane3
static PlaneNode PlaneNode
PlaneNode PlaneNode
plane4

Protected Member Functions

virtual int compare_to_impl (const RenderAttrib *other) const
 Intended to be overridden by derived ClipPlaneAttrib types to return a unique number indicating whether this ClipPlaneAttrib is equivalent to the other one.
virtual CPT (RenderAttrib) invert_compose_impl(const RenderAttrib *other) const
virtual CPT (RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const
virtual CPT (RenderAttrib) compose_impl(const RenderAttrib *other) const
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 ClipPlaneAttrib.
virtual size_t get_hash_impl () const
 Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type ClipPlaneAttrib is encountered in the Bam file.

Detailed Description

This functions similarly to a LightAttrib.

It indicates the set of clipping planes that modify the geometry at this level and below. A ClipPlaneAttrib can either add planes or remove planes from the total set of clipping planes in effect.

Definition at line 34 of file clipPlaneAttrib.h.


Member Function Documentation

int ClipPlaneAttrib::compare_to_impl ( const RenderAttrib other) const [protected, virtual]

Intended to be overridden by derived ClipPlaneAttrib types to return a unique number indicating whether this ClipPlaneAttrib is equivalent to the other one.

This should return 0 if the two ClipPlaneAttrib objects are equivalent, a number less than zero if this one should be sorted before the other one, and a number greater than zero otherwise.

This will only be called with two ClipPlaneAttrib objects whose get_type() functions return the same.

Reimplemented from RenderAttrib.

Definition at line 666 of file clipPlaneAttrib.cxx.

References ordered_vector< Key, Compare >::begin(), NodePath::compare_to(), and ordered_vector< Key, Compare >::end().

int ClipPlaneAttrib::complete_pointers ( TypedWritable **  p_list,
BamReader manager 
) [virtual]

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

Reimplemented from TypedWritable.

Definition at line 989 of file clipPlaneAttrib.cxx.

References ordered_vector< Key, Compare >::begin(), ordered_vector< Key, Compare >::end(), AttribNodeRegistry::find_node(), AttribNodeRegistry::get_node(), and ov_set< Key, Compare >::sort().

void ClipPlaneAttrib::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 ClipPlaneAttrib.

Reimplemented from RenderAttrib.

Definition at line 1073 of file clipPlaneAttrib.cxx.

References DatagramIterator::get_bool(), DatagramIterator::get_uint16(), ordered_vector< Key, Compare >::push_back(), and BamReader::read_pointer().

Referenced by make_from_bam().

size_t ClipPlaneAttrib::get_hash_impl ( ) const [protected, virtual]

Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.

RenderAttribs that compare the same with compare_to_impl(), above, should return the same hash; RenderAttribs that compare differently should return a different hash.

Reimplemented from RenderAttrib.

Definition at line 734 of file clipPlaneAttrib.cxx.

References integer_hash< Key, Compare >::add_hash(), NodePath::add_hash(), ordered_vector< Key, Compare >::begin(), and ordered_vector< Key, Compare >::end().

int ClipPlaneAttrib::get_num_off_planes ( ) const [inline]

Returns the number of planes that are disabled by the attribute.

Definition at line 83 of file clipPlaneAttrib.I.

References ordered_vector< Key, Compare >::size().

Referenced by get_num_planes(), get_operation(), get_plane(), has_plane(), and write_datagram().

int ClipPlaneAttrib::get_num_on_planes ( ) const [inline]
int ClipPlaneAttrib::get_num_planes ( ) const

Returns the number of planes listed in the attribute.

This method is now deprecated. ClipPlaneAttribs nowadays have a separate list of on_planes and off_planes, so this method doesn't make sense. Query the lists independently.

Definition at line 268 of file clipPlaneAttrib.cxx.

References get_num_off_planes(), and get_num_on_planes().

NodePath ClipPlaneAttrib::get_off_plane ( int  n) const [inline]

Returns the nth plane disabled by the attribute, sorted in arbitrary (pointer) order.

Definition at line 94 of file clipPlaneAttrib.I.

References NodePath::fail(), and ordered_vector< Key, Compare >::size().

Referenced by get_plane().

NodePath ClipPlaneAttrib::get_on_plane ( int  n) const [inline]

Returns the nth plane enabled by the attribute, sorted in render order.

Definition at line 60 of file clipPlaneAttrib.I.

References NodePath::fail(), and ordered_vector< Key, Compare >::size().

Referenced by PGItem::activate_region(), CollisionBox::apply_clip_plane(), GraphicsStateGuardian::fetch_specified_part(), and get_plane().

ClipPlaneAttrib::Operation ClipPlaneAttrib::get_operation ( ) const

Returns the basic operation type of the ClipPlaneAttrib.

If this is O_set, the planes listed here completely replace any planes that were already on. If this is O_add, the planes here are added to the set of of planes that were already on, and if O_remove, the planes here are removed from the set of planes that were on.

This method is now deprecated. ClipPlaneAttribs nowadays have a separate list of on_planes and off_planes, so this method doesn't make sense. Query the lists independently.

Definition at line 242 of file clipPlaneAttrib.cxx.

References get_num_off_planes(), and has_all_off().

PlaneNode * ClipPlaneAttrib::get_plane ( int  n) const

Returns the nth plane listed in the attribute.

This method is now deprecated. ClipPlaneAttribs nowadays have a separate list of on_planes and off_planes, so this method doesn't make sense. Query the lists independently.

Definition at line 290 of file clipPlaneAttrib.cxx.

References get_num_off_planes(), get_off_plane(), and get_on_plane().

bool ClipPlaneAttrib::has_all_off ( ) const [inline]

Returns true if this attrib disables all planes (although it may also enable some).

Definition at line 118 of file clipPlaneAttrib.I.

Referenced by get_operation(), and NodePath::has_clip_plane_off().

bool ClipPlaneAttrib::has_off_plane ( const NodePath plane) const [inline]

Returns true if the indicated plane is disabled by the attrib, false otherwise.

Definition at line 106 of file clipPlaneAttrib.I.

References ordered_vector< Key, Compare >::end(), and has_on_plane().

Referenced by NodePath::has_clip_plane_off(), and has_plane().

bool ClipPlaneAttrib::has_on_plane ( const NodePath plane) const [inline]

Returns true if the indicated plane is enabled by the attrib, false otherwise.

Definition at line 72 of file clipPlaneAttrib.I.

References ordered_vector< Key, Compare >::end().

Referenced by NodePath::has_clip_plane(), has_off_plane(), and has_plane().

bool ClipPlaneAttrib::has_plane ( PlaneNode plane) const

Returns true if the indicated plane is listed in the attrib, false otherwise.

This method is now deprecated. ClipPlaneAttribs nowadays have a separate list of on_planes and off_planes, so this method doesn't make sense. Query the lists independently.

Definition at line 313 of file clipPlaneAttrib.cxx.

References get_num_off_planes(), has_off_plane(), and has_on_plane().

bool ClipPlaneAttrib::is_identity ( ) const [inline]

Returns true if this is an identity attrib: it does not change the set of planes in use.

Definition at line 129 of file clipPlaneAttrib.I.

References ordered_vector< Key, Compare >::empty().

TypedWritable * ClipPlaneAttrib::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type ClipPlaneAttrib is encountered in the Bam file.

It should create the ClipPlaneAttrib and extract its information from the file.

Definition at line 1054 of file clipPlaneAttrib.cxx.

References fillin().

Referenced by register_with_read_factory().

void ClipPlaneAttrib::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type ClipPlaneAttrib.

Definition at line 942 of file clipPlaneAttrib.cxx.

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

bool ClipPlaneAttrib::require_fully_complete ( ) const [virtual]

Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.

If this is the case, override this method to return true, and be careful with circular references (which would make the object unreadable from a bam file).

Reimplemented from TypedWritable.

Definition at line 1041 of file clipPlaneAttrib.cxx.

void ClipPlaneAttrib::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 RenderAttrib.

Definition at line 953 of file clipPlaneAttrib.cxx.

References Datagram::add_bool(), Datagram::add_uint16(), ordered_vector< Key, Compare >::begin(), ordered_vector< Key, Compare >::end(), get_num_off_planes(), get_num_on_planes(), NodePath::node(), and BamWriter::write_pointer().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations