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

BillboardEffect Class Reference

Indicates that geometry at this node should automatically rotate to face the camera, or any other arbitrary node. More...

#include "billboardEffect.h"

Inheritance diagram for BillboardEffect:
RenderEffect TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Member Functions

virtual void adjust_transform (CPT(TransformState)&net_transform, CPT(TransformState)&node_transform, PandaNode *node) const
 Performs some operation on the node's apparent net and/or local transforms.
virtual CPT (TransformState) prepare_flatten_transform(const TransformState *net_transform) const
virtual void cull_callback (CullTraverser *trav, CullTraverserData &data, CPT(TransformState)&node_transform, CPT(RenderState)&node_state) const
 If has_cull_callback() returns true, 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 ()
bool get_axial_rotate () const
 Returns true if this billboard rotates only around the axis of the up vector, or false if it rotates freely in three dimensions.
bool get_eye_relative () const
 Returns true if this billboard interprets the up vector relative to the camera, or false if it is relative to the world.
const NodePathget_look_at () const
 Returns the node this billboard will rotate to look towards.
const LPoint3get_look_at_point () const
 Returns the point, relative to the look_at node, towards which the billboard will rotate.
PN_stdfloat get_offset () const
 Returns the distance toward the camera (or the look_at_point) the billboard is moved towards, after rotating.
virtual TypeHandle get_type () const
const LVector3get_up_vector () const
 Returns the up vector in effect for this billboard.
virtual bool has_adjust_transform () const
 Should be overridden by derived classes to return true if adjust_transform() has been defined, and therefore the RenderEffect has some effect on the node's apparent local and net transforms.
virtual bool has_cull_callback () const
 Should be overridden by derived classes to return true if cull_callback() has been defined.
bool is_off () const
 Returns true if the BillboardEffect is an 'off' BillboardEffect, indicating that it does not enable billboarding.
virtual void output (ostream &out) 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 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 (RenderEffect) make(const LVector3 &up_vector
static CPT (RenderEffect) make_axis()
static CPT (RenderEffect) make_point_world()
static CPT (RenderEffect) make_point_eye()
static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type BillboardEffect.

Public Attributes

static bool bool axial_rotate
static bool eye_relative
static bool bool PN_stdfloat
const NodePath
look_at
static bool bool PN_stdfloat
const NodePath const LPoint3
look_at_point
static bool bool PN_stdfloat offset

Protected Member Functions

virtual int compare_to_impl (const RenderEffect *other) const
 Intended to be overridden by derived BillboardEffect types to return a unique number indicating whether this BillboardEffect 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 BillboardEffect.

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 BillboardEffect is encountered in the Bam file.

Detailed Description

Indicates that geometry at this node should automatically rotate to face the camera, or any other arbitrary node.

Definition at line 30 of file billboardEffect.h.


Member Function Documentation

void BillboardEffect::adjust_transform ( CPT(TransformState)&  net_transform,
CPT(TransformState)&  node_transform,
PandaNode node 
) const [virtual]

Performs some operation on the node's apparent net and/or local transforms.

This will only be called if has_adjust_transform() is redefined to return true.

Both parameters are in/out. The original transforms will be passed in, and they may (or may not) be modified in-place by the RenderEffect.

Reimplemented from RenderEffect.

Definition at line 195 of file billboardEffect.cxx.

References NodePath::is_empty().

int BillboardEffect::compare_to_impl ( const RenderEffect other) const [protected, virtual]

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

This should return 0 if the two BillboardEffect 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 BillboardEffect objects whose get_type() functions return the same.

Reimplemented from RenderEffect.

Definition at line 228 of file billboardEffect.cxx.

References NodePath::compare_to(), and LVecBase3f::compare_to().

void BillboardEffect::cull_callback ( CullTraverser trav,
CullTraverserData data,
CPT(TransformState)&  node_transform,
CPT(RenderState)&  node_state 
) const [virtual]

If has_cull_callback() returns true, 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.

At the time this function is called, the current node's transform and state have not yet been applied to the net_transform and net_state. This callback may modify the node_transform and node_state to apply an effective change to the render state at this level.

Reimplemented from RenderEffect.

Definition at line 143 of file billboardEffect.cxx.

References CullTraverser::get_camera_transform(), and NodePath::is_empty().

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

Reimplemented from RenderEffect.

Definition at line 386 of file billboardEffect.cxx.

References DatagramIterator::get_bool(), DatagramIterator::get_stdfloat(), and LVecBase3f::read_datagram().

Referenced by make_from_bam().

bool BillboardEffect::get_axial_rotate ( ) const [inline]

Returns true if this billboard rotates only around the axis of the up vector, or false if it rotates freely in three dimensions.

Definition at line 109 of file billboardEffect.I.

bool BillboardEffect::get_eye_relative ( ) const [inline]

Returns true if this billboard interprets the up vector relative to the camera, or false if it is relative to the world.

Definition at line 97 of file billboardEffect.I.

const NodePath & BillboardEffect::get_look_at ( ) const [inline]

Returns the node this billboard will rotate to look towards.

If this is empty, it means the billboard will rotate towards the current camera node, wherever that might be.

Definition at line 135 of file billboardEffect.I.

const LPoint3 & BillboardEffect::get_look_at_point ( ) const [inline]

Returns the point, relative to the look_at node, towards which the billboard will rotate.

Normally this is (0, 0, 0).

Definition at line 147 of file billboardEffect.I.

PN_stdfloat BillboardEffect::get_offset ( ) const [inline]

Returns the distance toward the camera (or the look_at_point) the billboard is moved towards, after rotating.

This can be used to ensure the billboard is not obscured by nearby geometry.

Definition at line 122 of file billboardEffect.I.

const LVector3 & BillboardEffect::get_up_vector ( ) const [inline]

Returns the up vector in effect for this billboard.

Definition at line 85 of file billboardEffect.I.

bool BillboardEffect::has_adjust_transform ( ) const [virtual]

Should be overridden by derived classes to return true if adjust_transform() has been defined, and therefore the RenderEffect has some effect on the node's apparent local and net transforms.

Reimplemented from RenderEffect.

Definition at line 175 of file billboardEffect.cxx.

References NodePath::is_empty().

bool BillboardEffect::has_cull_callback ( ) const [virtual]

Should be overridden by derived classes to return true if cull_callback() has been defined.

Otherwise, returns false to indicate cull_callback() does not need to be called for this effect during the cull traversal.

Reimplemented from RenderEffect.

Definition at line 121 of file billboardEffect.cxx.

bool BillboardEffect::is_off ( ) const [inline]

Returns true if the BillboardEffect is an 'off' BillboardEffect, indicating that it does not enable billboarding.

This kind of BillboardEffect isn't particularly useful and isn't normally created or stored in the graph; it might be implicitly discovered as the result of a NodePath::get_rel_state().

Definition at line 75 of file billboardEffect.I.

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

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

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

Definition at line 367 of file billboardEffect.cxx.

References fillin().

Referenced by register_with_read_factory().

void BillboardEffect::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type BillboardEffect.

Definition at line 333 of file billboardEffect.cxx.

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

bool BillboardEffect::safe_to_transform ( ) const [virtual]

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 56 of file billboardEffect.cxx.

void BillboardEffect::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 RenderEffect.

Definition at line 344 of file billboardEffect.cxx.

References Datagram::add_bool(), Datagram::add_stdfloat(), and LVecBase3f::write_datagram().


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