#include <compassEffect.h>
Inheritance diagram for CompassEffect:
Public Types | |
enum | Properties { P_x = 0x001, P_y = 0x002, P_z = 0x004, P_pos = 0x007, P_rot = 0x008, P_sx = 0x010, P_sy = 0x020, P_sz = 0x040, P_scale = 0x070, P_all = 0x07f } |
Public Member Functions | |
const NodePath & | get_reference () const |
Returns the reference node from which the CompassEffect inherits its transform. | |
int | get_properties () const |
virtual bool | safe_to_transform () const |
Returns true if it is generally safe to transform this particular kind of RenderEffect by calling the xform() method, false otherwise. | |
virtual void | output (ostream &out) const |
ConstPointerTo< TransformState > | do_compass (const TransformState *net_transform, const TransformState *node_transform) const |
Computes the appropriate transform to rotate the node according to the reference node, or to the root transform if there is no reference node. | |
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 () |
int | compare_to (const RenderEffect &other) const |
Provides an arbitrary ordering among all unique RenderEffects, so we can store the essentially different ones in a big set and throw away the rest. | |
virtual bool | safe_to_combine () const |
Returns true if this kind of effect can safely be combined with sibling nodes that share the exact same effect, or false if this is not a good idea. | |
virtual ConstPointerTo< RenderEffect > | xform (const LMatrix4f &mat) const |
Returns a new RenderEffect transformed by the indicated matrix. | |
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< RenderEffect > | make (const NodePath &reference, int properties=P_rot) |
Constructs a new CompassEffect object. | |
void | register_with_read_factory () |
Tells the BamReader how to create objects of type CompassEffect. | |
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 RenderEffect *other) const |
Intended to be overridden by derived CompassEffect types to return a unique number indicating whether this CompassEffect is equivalent to the other one. | |
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 CompassEffect. | |
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 CompassEffect is encountered in the Bam file. | |
ConstPointerTo< RenderEffect > | return_new (RenderEffect *effect) |
This function is used by derived RenderEffect types to share a common RenderEffect pointer for all equivalent RenderEffect objects. | |
TypedWritable * | new_from_bam (RenderEffect *effect, BamReader *manager) |
Private Member Functions | |
CompassEffect () | |
Use CompassEffect::make() to construct a new CompassEffect object. | |
Private Attributes | |
NodePath | _reference |
int | _properties |
Static Private Attributes | |
TypeHandle | _type_handle |
In its purest form, a CompassEffect is used to keep the node's rotation fixed relative to the top of the scene graph, despite other transforms that may exist above the node. Hence the name: the node behaves like a magnetic compass, always pointing in the same direction.
As an couple of generalizing extensions, the CompassEffect may also be set up to always orient its node according to some other reference node than the root of the scene graph. Furthermore, it may optionally adjust any of pos, rotation, or scale, instead of necessarily rotation; and it may adjust individual pos and scale components. (Rotation may not be adjusted on an individual component basis; that's just asking for trouble.)
Be careful when using the pos and scale modes. In these modes, it's possible for the CompassEffect to move its node far from its normal bounding volume, causing culling to fail. If this is an issue, you may need to explicitly set a large (or infinite) bounding volume on the effect node.
Definition at line 92 of file compassEffect.h.
|
Definition at line 97 of file compassEffect.h. |
|
Use CompassEffect::make() to construct a new CompassEffect object.
Definition at line 34 of file compassEffect.I. References _reference, and INLINE. |
|
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 294 of file renderEffect.cxx. |
|
Provides an arbitrary ordering among all unique RenderEffects, 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 RenderEffect class because all equivalent RenderEffect objects are guaranteed to share the same pointer; thus, a pointer comparison is always sufficient. Definition at line 46 of file renderEffect.I. |
|
Intended to be overridden by derived CompassEffect types to return a unique number indicating whether this CompassEffect is equivalent to the other one. This should return 0 if the two CompassEffect 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 CompassEffect objects whose get_type() functions return the same. Reimplemented from RenderEffect. Definition at line 254 of file compassEffect.cxx. References fillin(), and parse_params(). |
|
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(). |
|
Computes the appropriate transform to rotate the node according to the reference node, or to the root transform if there is no reference node.
Definition at line 138 of file compassEffect.cxx. |
|
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new CompassEffect.
Reimplemented from RenderEffect. Definition at line 340 of file compassEffect.cxx. Referenced by compare_to_impl(). |
|
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 325 of file renderEffect.cxx. |
|
Reimplemented from RenderEffect. Definition at line 149 of file compassEffect.h. |
|
Reimplemented from RenderEffect. Definition at line 138 of file compassEffect.h. Referenced by NodePath::set_render_mode_wireframe(). |
|
|
|
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 reference node from which the CompassEffect inherits its transform. If this is empty, it means the root of the scene graph. Definition at line 51 of file compassEffect.I. References _properties, and INLINE. |
|
Reimplemented from RenderEffect. Definition at line 146 of file compassEffect.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 RenderEffect. Definition at line 141 of file compassEffect.h. |
|
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(). |
|
|
Constructs a new CompassEffect object. If the reference is an empty NodePath, it means the CompassEffect is relative to the root of the scene graph; otherwise, it's relative to the indicated node. The properties bitmask specifies the set of properties that the compass node inherits from the reference instead of from its parent. Definition at line 53 of file compassEffect.cxx. Referenced by NodePath::get_fog(). |
|
This function is called by the BamReader's factory when a new object of type CompassEffect is encountered in the Bam file. It should create the CompassEffect and extract its information from the file. Definition at line 316 of file compassEffect.cxx. |
|
|
|
Reimplemented from RenderEffect. Definition at line 86 of file compassEffect.cxx. |
|
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 CompassEffect.
Definition at line 279 of file compassEffect.cxx. References _properties, RenderEffect::fillin(), and DatagramIterator::get_uint16(). |
|
This function is used by derived RenderEffect types to share a common RenderEffect pointer for all equivalent RenderEffect objects. The make() function of the derived type should create a new RenderEffect 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 201 of file renderEffect.cxx. References TypedWritable::write_datagram(). |
|
Returns true if this kind of effect can safely be combined with sibling nodes that share the exact same effect, or false if this is not a good idea.
Reimplemented in DecalEffect, and ShowBoundsEffect. Definition at line 129 of file renderEffect.cxx. References indent(). |
|
Returns true if it is generally safe to transform this particular kind of RenderEffect by calling the xform() method, false otherwise.
Reimplemented from RenderEffect. Definition at line 73 of file compassEffect.cxx. |
|
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 170 of file renderEffect.cxx. |
|
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented from RenderEffect. Definition at line 294 of file compassEffect.cxx. |
|
Returns a new RenderEffect transformed by the indicated matrix.
Definition at line 144 of file renderEffect.cxx. |
|
Definition at line 127 of file compassEffect.h. Referenced by get_reference(), and register_with_read_factory(). |
|
Definition at line 126 of file compassEffect.h. Referenced by CompassEffect(). |
|
Reimplemented from RenderEffect. Definition at line 30 of file compassEffect.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(). |