Panda3D
|
Represents a transform that may be applied to a particular instance of a tree when added to the SpeedTreeNode. More...
#include "stTransform.h"
Public Member Functions | |
STTransform () | |
The default constructor creates an identity transform. | |
STTransform (const TransformState *trans) | |
This constructor accepts a Panda TransformState, for instance as extracted from the scene graph. | |
STTransform (PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat rotate, PN_stdfloat scale) | |
Construct a transform with componentwise inputs. | |
STTransform (const STTransform ©) | |
STTransform (const LPoint3 &pos, PN_stdfloat rotate=0.0f, PN_stdfloat scale=1.0f) | |
Construct a transform with componentwise inputs. | |
STTransform (const SpeedTree::CInstance &instance) | |
This is used internally to construct an STTransform from a SpeedTree::CInstance object. | |
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 SpeedTreeNode. | |
const LPoint3 & | get_pos () const |
Returns the translation component. | |
PN_stdfloat | get_rotate () const |
Returns the rotation component, in degrees counter-clockwise around the vertical axis. | |
PN_stdfloat | get_scale () const |
Returns the scale component, as a uniform scale value. | |
operator SpeedTree::CInstance () const | |
This is used internally to convert an STTransform into a SpeedTree::CInstance object. | |
STTransform | operator* (const STTransform &other) const |
Composes these transforms and returns the result/. | |
void | operator*= (const STTransform &other) |
Composes these transforms and stores the result in-place. | |
void | operator= (const STTransform ©) |
void | output (ostream &out) const |
void | set_pos (const LPoint3 &pos) |
Replaces the translation component. | |
void | set_rotate (PN_stdfloat rotate) |
Replaces the rotation component. | |
void | set_scale (PN_stdfloat scale) |
Replaces the scale component. | |
operator CPT() | TransformState () const |
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 const STTransform & | ident_mat () |
Returns a global identity transform object. | |
Public Attributes | |
LPoint3 | _pos |
PN_stdfloat | _rotate |
PN_stdfloat | _scale |
Static Public Attributes | |
static STTransform | _ident_mat |
Represents a transform that may be applied to a particular instance of a tree when added to the SpeedTreeNode.
Definition at line 29 of file stTransform.h.
STTransform::STTransform | ( | ) | [inline] |
The default constructor creates an identity transform.
Definition at line 22 of file stTransform.I.
STTransform::STTransform | ( | const TransformState * | trans | ) |
This constructor accepts a Panda TransformState, for instance as extracted from the scene graph.
Definition at line 26 of file stTransform.cxx.
References TransformState::get_hpr(), TransformState::get_pos(), TransformState::get_uniform_scale(), TransformState::has_components(), and TransformState::has_uniform_scale().
STTransform::STTransform | ( | const LPoint3 & | pos, |
PN_stdfloat | rotate = 0.0f , |
||
PN_stdfloat | scale = 1.0f |
||
) | [inline] |
Construct a transform with componentwise inputs.
Definition at line 35 of file stTransform.I.
STTransform::STTransform | ( | PN_stdfloat | x, |
PN_stdfloat | y, | ||
PN_stdfloat | z, | ||
PN_stdfloat | rotate, | ||
PN_stdfloat | scale | ||
) | [inline] |
Construct a transform with componentwise inputs.
Definition at line 48 of file stTransform.I.
STTransform::STTransform | ( | const SpeedTree::CInstance & | instance | ) | [inline] |
This is used internally to construct an STTransform from a SpeedTree::CInstance object.
Definition at line 87 of file stTransform.I.
void STTransform::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 SpeedTreeNode.
Definition at line 77 of file stTransform.cxx.
References DatagramIterator::get_stdfloat(), and LVecBase3f::read_datagram().
Referenced by SpeedTreeNode::InstanceList::fillin().
const LPoint3 & STTransform::get_pos | ( | ) | const [inline] |
Returns the translation component.
Definition at line 148 of file stTransform.I.
Referenced by operator*=(), and SpeedTreeNode::snap_to_terrain().
PN_stdfloat STTransform::get_rotate | ( | ) | const [inline] |
Returns the rotation component, in degrees counter-clockwise around the vertical axis.
Definition at line 171 of file stTransform.I.
PN_stdfloat STTransform::get_scale | ( | ) | const [inline] |
Returns the scale component, as a uniform scale value.
Definition at line 193 of file stTransform.I.
const STTransform & STTransform::ident_mat | ( | ) | [inline, static] |
Returns a global identity transform object.
Definition at line 128 of file stTransform.I.
Referenced by SpeedTreeNode::InstanceList::get_instance().
STTransform::operator SpeedTree::CInstance | ( | ) | const [inline] |
This is used internally to convert an STTransform into a SpeedTree::CInstance object.
Definition at line 101 of file stTransform.I.
STTransform STTransform::operator* | ( | const STTransform & | other | ) | const [inline] |
Composes these transforms and returns the result/.
Definition at line 218 of file stTransform.I.
void STTransform::operator*= | ( | const STTransform & | other | ) | [inline] |
Composes these transforms and stores the result in-place.
Definition at line 204 of file stTransform.I.
References get_pos(), LQuaternionf::set_hpr(), and LQuaternionf::xform().
void STTransform::set_pos | ( | const LPoint3 & | pos | ) | [inline] |
Replaces the translation component.
Definition at line 138 of file stTransform.I.
Referenced by SpeedTreeNode::snap_to_terrain().
void STTransform::set_rotate | ( | PN_stdfloat | rotate | ) | [inline] |
Replaces the rotation component.
Accepts a rotation in degrees counter-clockwise around the vertical axis.
Definition at line 160 of file stTransform.I.
void STTransform::set_scale | ( | PN_stdfloat | scale | ) | [inline] |
Replaces the scale component.
Accepts a uniform scale value.
Definition at line 182 of file stTransform.I.
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition at line 63 of file stTransform.cxx.
References Datagram::add_stdfloat(), and LVecBase3f::write_datagram().
Referenced by SpeedTreeNode::InstanceList::write_datagram().