Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
STTransform Class Reference

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 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.
| STTransform (const STTransform &copy)
| 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.
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 &copy)
void | output (std::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

## Detailed Description

Represents a transform that may be applied to a particular instance of a tree when added to the SpeedTreeNode.

Definition at line 26 of file stTransform.h.

## Constructor & Destructor Documentation

## ◆ STTransform() [1/6]

STTransform::STTransform | ( |  | ) |
| inline

The default constructor creates an identity transform.

Definition at line 17 of file stTransform.I.

Referenced by ident_mat(), operator*(), and operator*=().

## ◆ STTransform() [2/6]

STTransform::STTransform | ( | const TransformState * | trans | ) |

This constructor accepts a Panda TransformState, for instance as extracted from the scene graph.

Definition at line 22 of file stTransform.cxx.

References TransformState::get_hpr, TransformState::get_pos, TransformState::get_uniform_scale(), TransformState::has_components(), and TransformState::has_uniform_scale().

## ◆ STTransform() [3/6]

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 28 of file stTransform.I.

## ◆ STTransform() [4/6]

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 39 of file stTransform.I.

## ◆ STTransform() [5/6]

STTransform::STTransform | ( | const STTransform & | copy | ) |
| inline

Definition at line 50 of file stTransform.I.

## ◆ STTransform() [6/6]

STTransform::STTransform | ( | const SpeedTree::CInstance & | instance | ) |
| inline

This is used internally to construct an STTransform from a SpeedTree::CInstance object.

Definition at line 72 of file stTransform.I.

## Member Function Documentation

## ◆ fillin()

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 66 of file stTransform.cxx.

References DatagramIterator::get_stdfloat().

Referenced by SpeedTreeNode::InstanceList::fillin().

## ◆ get_pos()

const LPoint3 & STTransform::get_pos | ( |  | ) | const
| inline

Returns the translation component.

Definition at line 123 of file stTransform.I.

Referenced by operator*=(), and SpeedTreeNode::snap_to_terrain().

## ◆ get_rotate()

PN_stdfloat STTransform::get_rotate | ( |  | ) | const
| inline

Returns the rotation component, in degrees counter-clockwise around the vertical axis.

Definition at line 141 of file stTransform.I.

## ◆ get_scale()

PN_stdfloat STTransform::get_scale | ( |  | ) | const
| inline

Returns the scale component, as a uniform scale value.

Definition at line 157 of file stTransform.I.

## ◆ ident_mat()

const STTransform & STTransform::ident_mat | ( |  | ) |
| inline static

Returns a global identity transform object.

Definition at line 107 of file stTransform.I.

References STTransform().

## ◆ operator SpeedTree::CInstance()

STTransform::operator SpeedTree::CInstance | ( |  | ) | const
| inline

This is used internally to convert an STTransform into a SpeedTree::CInstance object.

Definition at line 84 of file stTransform.I.

## ◆ operator*()

STTransform STTransform::operator* | ( | const STTransform & | other | ) | const
| inline

Composes these transforms and returns the result.

Definition at line 177 of file stTransform.I.

References STTransform().

## ◆ operator*=()

void STTransform::operator*= | ( | const STTransform & | other | ) |
| inline

Composes these transforms and stores the result in-place.

Definition at line 165 of file stTransform.I.

References STTransform(), and get_pos().

## ◆ operator=()

void STTransform::operator= | ( | const STTransform & | copy | ) |
| inline

Definition at line 61 of file stTransform.I.

## ◆ output()

void STTransform::output | ( | std::ostream & | out | ) | const

Definition at line 46 of file stTransform.cxx.

## ◆ set_pos()

void STTransform::set_pos | ( | const LPoint3 & | pos | ) |
| inline

Replaces the translation component.

Definition at line 115 of file stTransform.I.

Referenced by SpeedTreeNode::snap_to_terrain().

## ◆ set_rotate()

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 132 of file stTransform.I.

## ◆ set_scale()

void STTransform::set_scale | ( | PN_stdfloat | scale | ) |
| inline

Replaces the scale component.

Accepts a uniform scale value.

Definition at line 149 of file stTransform.I.

## ◆ write_datagram()

void STTransform::write_datagram | ( | BamWriter * | manager,
|  | Datagram & | dg )

Writes the contents of this object to the datagram for shipping out to a Bam file.

Definition at line 55 of file stTransform.cxx.

References Datagram::add_stdfloat().

Referenced by SpeedTreeNode::InstanceList::write_datagram().

## Member Data Documentation

## ◆ _ident_mat

STTransform STTransform::_ident_mat
| static

Definition at line 64 of file stTransform.h.

## ◆ _pos

LPoint3 STTransform::_pos

Definition at line 60 of file stTransform.h.

## ◆ _rotate

PN_stdfloat STTransform::_rotate

Definition at line 61 of file stTransform.h.

## ◆ _scale

PN_stdfloat STTransform::_scale

Definition at line 62 of file stTransform.h.

The documentation for this class was generated from the following files:

- panda/src/speedtree/stTransform.h
- panda/src/speedtree/stTransform.cxx
- panda/src/speedtree/stTransform.I