Panda3D
|
A base class for any of a broad family of flt records that represent particular beads in the hierarchy. More...
#include "fltBead.h"
Public Member Functions | |
FltBead (FltHeader *header) | |
void | add_transform_step (FltTransformRecord *record) |
Applies the indicated transform step to the net transformation applied to the bead. | |
void | clear_transform () |
Removes any transform matrix and all transform steps on this bead. | |
virtual TypeHandle | force_init_type () |
int | get_num_transform_steps () const |
Returns the number of individual steps that define the net transform on this bead as returned by set_transform(). | |
int | get_replicate_count () const |
Returns the replicate count of this bead. | |
const LMatrix4d & | get_transform () const |
Returns the single-precision 4x4 matrix that represents the transform applied to this bead, or the identity matrix if the bead has not been transformed. | |
FltTransformRecord * | get_transform_step (int n) |
Returns the nth individual step that defines the net transform on this bead. | |
const FltTransformRecord * | get_transform_step (int n) const |
Returns the nth individual step that defines the net transform on this bead. | |
virtual TypeHandle | get_type () const |
bool | has_transform () const |
Returns true if the bead has been transformed, false otherwise. | |
void | set_replicate_count (int count) |
Changes the replicate count of this bead. | |
void | set_transform (const LMatrix4d &mat) |
Replaces the transform matrix on this bead. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
Protected Member Functions | |
virtual bool | build_record (FltRecordWriter &writer) const |
Fills up the current record on the FltRecordWriter with data for this record, but does not advance the writer. | |
virtual bool | extract_ancillary (FltRecordReader &reader) |
Checks whether the given bead, which follows this bead sequentially in the file, is an ancillary record of this bead. | |
virtual bool | extract_record (FltRecordReader &reader) |
Fills in the information in this bead based on the information given in the indicated datagram, whose opcode has already been read. | |
virtual FltError | write_ancillary (FltRecordWriter &writer) const |
Writes whatever ancillary records are required for this record. |
A base class for any of a broad family of flt records that represent particular beads in the hierarchy.
These are things like group beads and object beads, as opposed to things like push and pop or comment records.
void FltBead::add_transform_step | ( | FltTransformRecord * | record | ) |
Applies the indicated transform step to the net transformation applied to the bead.
Definition at line 149 of file fltBead.cxx.
References FltTransformRecord::get_matrix().
Referenced by set_transform().
bool FltBead::build_record | ( | FltRecordWriter & | writer | ) | const [protected, virtual] |
Fills up the current record on the FltRecordWriter with data for this record, but does not advance the writer.
Returns true on success, false if there is some error.
Reimplemented from FltRecord.
Reimplemented in FltHeader, FltGeometry, FltExternalReference, FltCurve, FltMeshPrimitive, FltObject, FltGroup, FltLOD, FltInstanceRef, FltBeadID, FltInstanceDefinition, FltMesh, and FltFace.
Definition at line 274 of file fltBead.cxx.
References FltRecord::build_record().
Referenced by FltBeadID::build_record(), FltInstanceDefinition::build_record(), FltInstanceRef::build_record(), FltMeshPrimitive::build_record(), and FltExternalReference::build_record().
void FltBead::clear_transform | ( | ) |
Removes any transform matrix and all transform steps on this bead.
Definition at line 93 of file fltBead.cxx.
References LMatrix4d::ident_mat().
Referenced by set_transform().
bool FltBead::extract_ancillary | ( | FltRecordReader & | reader | ) | [protected, virtual] |
Checks whether the given bead, which follows this bead sequentially in the file, is an ancillary record of this bead.
If it is, extracts the relevant information and returns true; otherwise, leaves it alone and returns false.
Reimplemented from FltRecord.
Reimplemented in FltHeader, FltBeadID, and FltMesh.
Definition at line 213 of file fltBead.cxx.
References FltRecord::extract_record(), and FltRecordReader::get_opcode().
bool FltBead::extract_record | ( | FltRecordReader & | reader | ) | [protected, virtual] |
Fills in the information in this bead based on the information given in the indicated datagram, whose opcode has already been read.
Returns true on success, false if the datagram is invalid.
Reimplemented from FltRecord.
Reimplemented in FltHeader, FltGeometry, FltExternalReference, FltCurve, FltMeshPrimitive, FltObject, FltGroup, FltLOD, FltInstanceRef, FltInstanceDefinition, FltBeadID, FltMesh, and FltFace.
Definition at line 196 of file fltBead.cxx.
References FltRecord::extract_record().
Referenced by FltBeadID::extract_record(), FltInstanceDefinition::extract_record(), FltInstanceRef::extract_record(), FltMeshPrimitive::extract_record(), and FltExternalReference::extract_record().
int FltBead::get_num_transform_steps | ( | ) | const |
Returns the number of individual steps that define the net transform on this bead as returned by set_transform().
Each step is a single transformation; the concatenation of all transformations will produce the matrix represented by set_transform().
Definition at line 110 of file fltBead.cxx.
Referenced by FltToEggLevelState::set_transform().
int FltBead::get_replicate_count | ( | ) | const |
Returns the replicate count of this bead.
If this is nonzero, it means that the bead is implicitly copied this number of additional times (for replicate_count + 1 total copies), applying the transform on this bead for each copy. In this case, the transform does not* apply to the initial copy of the bead.
Definition at line 170 of file fltBead.cxx.
const LMatrix4d & FltBead::get_transform | ( | ) | const |
Returns the single-precision 4x4 matrix that represents the transform applied to this bead, or the identity matrix if the bead has not been transformed.
Definition at line 66 of file fltBead.cxx.
References LMatrix4d::ident_mat().
Referenced by FltToEggLevelState::get_synthetic_group(), and FltToEggLevelState::set_transform().
FltTransformRecord * FltBead::get_transform_step | ( | int | n | ) |
Returns the nth individual step that defines the net transform on this bead.
See get_num_transform_steps().
Definition at line 122 of file fltBead.cxx.
Referenced by FltToEggLevelState::set_transform().
const FltTransformRecord * FltBead::get_transform_step | ( | int | n | ) | const |
Returns the nth individual step that defines the net transform on this bead.
See get_num_transform_steps().
Definition at line 136 of file fltBead.cxx.
bool FltBead::has_transform | ( | ) | const |
Returns true if the bead has been transformed, false otherwise.
If this returns true, get_transform() will return the single-precision net transformation, and get_num_transform_steps() will return nonzero.
Definition at line 54 of file fltBead.cxx.
Referenced by FltToEggLevelState::set_transform().
static void FltBead::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from FltRecord.
Reimplemented in FltHeader, FltGeometry, FltExternalReference, FltCurve, FltMeshPrimitive, FltObject, FltGroup, FltLOD, FltInstanceRef, FltBeadID, FltMesh, FltInstanceDefinition, and FltFace.
void FltBead::set_replicate_count | ( | int | count | ) |
Changes the replicate count of this bead.
If you are setting the replicate count to some nonzero number, you must also set a transform on the bead. See set_replicate_count().
Definition at line 183 of file fltBead.cxx.
void FltBead::set_transform | ( | const LMatrix4d & | mat | ) |
Replaces the transform matrix on this bead.
This implicitly removes all of the transform steps added previously, and replaces them with a single 4x4 general matrix transform step.
Definition at line 79 of file fltBead.cxx.
References add_transform_step(), clear_transform(), and FltTransformGeneralMatrix::set_matrix().
FltError FltBead::write_ancillary | ( | FltRecordWriter & | writer | ) | const [protected, virtual] |