#include <cullFaceAttrib.h>
Inheritance diagram for CullFaceAttrib:
Public Types | |
enum | Mode { M_cull_none, M_cull_clockwise, M_cull_counter_clockwise, M_cull_unchanged } |
enum | PandaCompareFunc { M_none = 0, M_never, M_less, M_equal, M_less_equal, M_greater, M_not_equal, M_greater_equal, M_always } |
Public Member Functions | |
Mode | get_actual_mode () const |
Returns the actual culling mode, without considering the effects of the reverse flag. | |
bool | get_reverse () const |
Returns the 'reverse' flag. | |
Mode | get_effective_mode () const |
Returns the effective culling mode. | |
virtual void | issue (GraphicsStateGuardianBase *gsg) const |
Calls the appropriate method on the indicated GSG to issue the graphics commands appropriate to the given attribute. | |
virtual void | output (ostream &out) 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. | |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
ConstPointerTo< RenderAttrib > | compose (const RenderAttrib *other) const |
ConstPointerTo< RenderAttrib > | invert_compose (const RenderAttrib *other) const |
ConstPointerTo< RenderAttrib > | make_default () const |
int | compare_to (const RenderAttrib &other) const |
Provides an arbitrary ordering among all unique RenderAttribs, so we can store the essentially different ones in a big set and throw away the rest. | |
virtual void | write (ostream &out, int indent_level) const |
virtual void | finalize () |
Method to ensure that any necessary clean up tasks that have to be performed by this object are performed. | |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). | |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
int | get_ref_count () const |
Returns the current reference count. | |
int | ref () const |
Explicitly increments the reference count. | |
int | unref () const |
Explicitly decrements the reference count. | |
void | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
Static Public Member Functions | |
ConstPointerTo< RenderAttrib > | make (Mode mode=M_cull_clockwise) |
Constructs a new CullFaceAttrib object that specifies how to cull geometry. | |
ConstPointerTo< RenderAttrib > | make_reverse () |
void | register_with_read_factory () |
Tells the BamReader how to create objects of type CullFaceAttrib. | |
TypeHandle | get_class_type () |
void | init_type () |
TypedWritable * | change_this (TypedWritable *old_ptr, BamReader *manager) |
Called immediately after complete_pointers(), this gives the object a chance to adjust its own pointer if desired. | |
Static Public Attributes | |
TypedWritable *const | Null = (TypedWritable*)0L |
Protected Member Functions | |
virtual int | compare_to_impl (const RenderAttrib *other) const |
Intended to be overridden by derived CullFaceAttrib types to return a unique number indicating whether this CullFaceAttrib is equivalent to the other one. | |
virtual ConstPointerTo< RenderAttrib > | compose_impl (const RenderAttrib *other) const |
Intended to be overridden by derived RenderAttrib types to specify how two consecutive RenderAttrib objects of the same type interact. | |
virtual ConstPointerTo< RenderAttrib > | invert_compose_impl (const RenderAttrib *other) const |
Intended to be overridden by derived RenderAttrib types to specify how two consecutive RenderAttrib objects of the same type interact. | |
virtual RenderAttrib * | make_default_impl () const |
Intended to be overridden by derived CullFaceAttrib types to specify what the default property for a CullFaceAttrib of this type should be. | |
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 CullFaceAttrib. | |
void | output_comparefunc (ostream &out, PandaCompareFunc fn) const |
Static Protected Member Functions | |
TypedWritable * | make_from_bam (const FactoryParams ¶ms) |
This function is called by the BamReader's factory when a new object of type CullFaceAttrib is encountered in the Bam file. | |
ConstPointerTo< RenderAttrib > | return_new (RenderAttrib *attrib) |
This function is used by derived RenderAttrib types to share a common RenderAttrib pointer for all equivalent RenderAttrib objects. | |
TypedWritable * | new_from_bam (RenderAttrib *attrib, BamReader *manager) |
Private Member Functions | |
CullFaceAttrib (Mode mode, bool reverse) | |
Use CullFaceAttrib::make() to construct a new CullFaceAttrib object. | |
Private Attributes | |
Mode | _mode |
bool | _reverse |
Static Private Attributes | |
TypeHandle | _type_handle |
Definition at line 38 of file cullFaceAttrib.h.
|
Definition at line 40 of file cullFaceAttrib.h. Referenced by NodePath::clear_texture(), compare_to_impl(), CullFaceAttrib(), and GLGraphicsStateGuardian::issue_material(). |
|
Definition at line 107 of file renderAttrib.h. Referenced by AlphaTestAttrib::AlphaTestAttrib(), DepthTestAttrib::DepthTestAttrib(), DXGraphicsStateGuardian8::enable_texturing(), GLGraphicsStateGuardian::issue_tex_matrix(), and GLGraphicsStateGuardian::issue_transform(). |
|
Use CullFaceAttrib::make() to construct a new CullFaceAttrib object.
Definition at line 34 of file cullFaceAttrib.I. References _mode, INLINE, and Mode. Referenced by compare_to_impl(), and make(). |
|
Called immediately after complete_pointers(), this gives the object a chance to adjust its own pointer if desired. Most objects don't change pointers after completion, but some need to. Once this function has been called, the old pointer will no longer be accessed. Definition at line 362 of file renderAttrib.cxx. |
|
Provides an arbitrary ordering among all unique RenderAttribs, so we can store the essentially different ones in a big set and throw away the rest. This method is not needed outside of the RenderAttrib class because all equivalent RenderAttrib objects are guaranteed to share the same pointer; thus, a pointer comparison is always sufficient. Definition at line 125 of file renderAttrib.I. |
|
Intended to be overridden by derived CullFaceAttrib types to return a unique number indicating whether this CullFaceAttrib is equivalent to the other one. This should return 0 if the two CullFaceAttrib 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 CullFaceAttrib objects whose get_type() functions return the same. Reimplemented from RenderAttrib. Definition at line 216 of file cullFaceAttrib.cxx. References _mode, _reverse, CullFaceAttrib(), DCAST_INTO_R, M_cull_unchanged, Mode, and RenderAttrib::return_new(). |
|
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). Returns the number of pointers processed. This is the callback function that is made by the BamReader at some later point, after all of the required pointers have been filled in. It is necessary because there might be forward references in a bam file; when we call read_pointer() in fillin(), the object may not have been read from the file yet, so we do not have a pointer available at that time. Thus, instead of returning a pointer, read_pointer() simply reserves a later callback. This function provides that callback. The calling object is responsible for keeping track of the number of times it called read_pointer() and extracting the same number of pointers out of the supplied vector, and storing them appropriately within the object. Reimplemented in AnimBundleNode, AnimGroup, PartBundleNode, PartGroup, Character, CharacterJoint, CollisionNode, GeomSprite, PiecewiseCurve, ClipPlaneAttrib, FogAttrib, LensNode, LightAttrib, MaterialAttrib, RenderEffects, RenderState, TextureAttrib, Person, and Child. Definition at line 94 of file typedWritable.cxx. Referenced by RenderState::do_invert_compose(). |
|
Referenced by LightAttrib::get_light(), LightAttrib::get_num_lights(), ClipPlaneAttrib::get_num_planes(), and ClipPlaneAttrib::get_plane(). |
|
Intended to be overridden by derived RenderAttrib types to specify how two consecutive RenderAttrib objects of the same type interact. This should return the result of applying the other RenderAttrib to a node in the scene graph below this RenderAttrib, which was already applied. In most cases, the result is the same as the other RenderAttrib (that is, a subsequent RenderAttrib completely replaces the preceding one). On the other hand, some kinds of RenderAttrib (for instance, ColorTransformAttrib) might combine in meaningful ways. Reimplemented from RenderAttrib. Definition at line 258 of file cullFaceAttrib.cxx. References get_class_type(), BamReader::get_factory(), make_from_bam(), and Factory< TypedWritable >::register_factory(). |
|
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new CullFaceAttrib.
Reimplemented from RenderAttrib. Definition at line 415 of file cullFaceAttrib.cxx. |
|
Method to ensure that any necessary clean up tasks that have to be performed by this object are performed.
Reimplemented from TypedWritable. Definition at line 393 of file renderAttrib.cxx. |
|
Reimplemented from RenderAttrib. Definition at line 92 of file cullFaceAttrib.h. |
|
Returns the actual culling mode, without considering the effects of the reverse flag. See also get_effective_mode(). Definition at line 53 of file cullFaceAttrib.I. References _reverse, and INLINE. Referenced by NodePath::has_texture_off(). |
|
Reimplemented from RenderAttrib. Definition at line 81 of file cullFaceAttrib.h. Referenced by compose_impl(), NodePath::has_texture(), and NodePath::has_texture_off(). |
|
Returns the effective culling mode. This is the same as the actual culling mode, unless the reverse flag is set, which swaps CW for CCW and vice-versa. Also, M_cull_unchanged is mapped to M_cull_none. Definition at line 105 of file cullFaceAttrib.cxx. References GraphicsStateGuardianBase::issue_cull_face(). Referenced by GLGraphicsStateGuardian::issue_material(). |
|
Returns the current reference count.
Definition at line 183 of file referenceCount.I. Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture(). |
|
Returns the 'reverse' flag. If this is true, the actual cull direction (clockwise vs. counterclockwise) is the reverse of what is specified here. This allows support for make_reverse(), which defines a CullFaceAttrib that reverses whatever the sense of culling would have been. Definition at line 78 of file cullFaceAttrib.I. |
|
Reimplemented from RenderAttrib. Definition at line 89 of file cullFaceAttrib.h. |
|
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). Definition at line 71 of file typedObject.I. References TypeHandle::get_name(), TypedObject::get_type(), and INLINE. |
|
Reimplemented from RenderAttrib. Definition at line 84 of file cullFaceAttrib.h. |
|
|
|
Intended to be overridden by derived RenderAttrib types to specify how two consecutive RenderAttrib objects of the same type interact. See invert_compose() and compose_impl(). Reimplemented from RenderAttrib. Definition at line 297 of file cullFaceAttrib.cxx. |
|
Returns true if the current object is the indicated type exactly.
Definition at line 101 of file typedObject.I. Referenced by PT(), and CollisionNode::xform(). |
|
|
Calls the appropriate method on the indicated GSG to issue the graphics commands appropriate to the given attribute. This is normally called (indirectly) only from GraphicsStateGuardian::set_state() or modify_state(). Reimplemented from RenderAttrib. Definition at line 153 of file cullFaceAttrib.cxx. References DCAST_INTO_R. |
|
Constructs a new CullFaceAttrib object that specifies how to cull geometry. By Panda convention, vertices are ordered counterclockwise when seen from the front, so the M_cull_clockwise will cull backfacing polygons. M_cull_unchanged is an identity attrib; if this is applied to vertices without any other intervening attrib, it is the same as applying the default attrib. Definition at line 59 of file cullFaceAttrib.cxx. References CullFaceAttrib(), M_cull_unchanged, and RenderAttrib::return_new(). Referenced by GLGraphicsStateGuardian::bind_texture(), NodePath::clear_texture(), CollisionSolid::fillin(), CollisionSolid::get_solid_viz_state(), and CullTraverser::make_bounds_viz(). |
|
|
|
Intended to be overridden by derived CullFaceAttrib types to specify what the default property for a CullFaceAttrib of this type should be. This should return a newly-allocated CullFaceAttrib of the same type that corresponds to whatever the standard default for this kind of CullFaceAttrib is. Implements RenderAttrib. Definition at line 339 of file cullFaceAttrib.cxx. |
|
This function is called by the BamReader's factory when a new object of type CullFaceAttrib is encountered in the Bam file. It should create the CullFaceAttrib and extract its information from the file. Definition at line 391 of file cullFaceAttrib.cxx. Referenced by compose_impl(). |
|
|
|
|
|
Reimplemented from RenderAttrib. Definition at line 166 of file cullFaceAttrib.cxx. References _mode. |
|
Definition at line 141 of file renderAttrib.cxx. References RenderAttrib::_attribs, RenderAttrib::_saved_entry, nassertr, and NULL. |
|
Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 225 of file referenceCount.I. Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering(). |
|
Tells the BamReader how to create objects of type CullFaceAttrib.
Definition at line 354 of file cullFaceAttrib.cxx. |
|
This function is used by derived RenderAttrib types to share a common RenderAttrib pointer for all equivalent RenderAttrib objects. The make() function of the derived type should create a new RenderAttrib and pass it through return_new(), which will either save the pointer and return it unchanged (if this is the first similar such object) or delete it and return an equivalent pointer (if there was already a similar object saved). Definition at line 186 of file renderAttrib.cxx. Referenced by compare_to_impl(), TextureAttrib::make(), MaterialAttrib::make(), LightAttrib::make(), FogAttrib::make(), make(), ClipPlaneAttrib::make(), LightAttrib::make_all_off(), ClipPlaneAttrib::make_all_off(), ColorAttrib::make_flat(), and ColorAttrib::make_vertex(). |
|
Does some easy checks to make sure that the reference count isn't completely bogus.
Definition at line 328 of file referenceCount.I. References INLINE. Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount(). |
|
Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 293 of file referenceCount.I. References INLINE. Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds(). |
|
Definition at line 155 of file renderAttrib.cxx. References RenderAttrib::_attribs. |
|
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented from RenderAttrib. Definition at line 369 of file cullFaceAttrib.cxx. |
|
Definition at line 69 of file cullFaceAttrib.h. Referenced by compare_to_impl(), CullFaceAttrib(), and output(). |
|
Definition at line 70 of file cullFaceAttrib.h. Referenced by compare_to_impl(), and get_actual_mode(). |
|
Reimplemented from RenderAttrib. Definition at line 30 of file cullFaceAttrib.cxx. |
|
Definition at line 25 of file typedWritable.cxx. Referenced by Child::complete_pointers(), Parent::complete_pointers(), Person::complete_pointers(), LoaderFileTypeBam::get_extension(), PartGroup::pick_channel_index(), BamReader::read_pointer(), and AnimGroup::write_datagram(). |