Panda3D
 All Classes Functions Variables Enumerations
fltBead.h
1 // Filename: fltBead.h
2 // Created by: drose (24Aug00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef FLTBEAD_H
16 #define FLTBEAD_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "fltRecord.h"
21 #include "fltTransformRecord.h"
22 
23 #include "luse.h"
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : FltBead
27 // Description : A base class for any of a broad family of flt records
28 // that represent particular beads in the hierarchy.
29 // These are things like group beads and object beads,
30 // as opposed to things like push and pop or comment
31 // records.
32 ////////////////////////////////////////////////////////////////////
33 class FltBead : public FltRecord {
34 public:
35  FltBead(FltHeader *header);
36 
37  bool has_transform() const;
38  const LMatrix4d &get_transform() const;
39  void set_transform(const LMatrix4d &mat);
40  void clear_transform();
41 
42  int get_num_transform_steps() const;
44  const FltTransformRecord *get_transform_step(int n) const;
46 
47  int get_replicate_count() const;
48  void set_replicate_count(int count);
49 
50 protected:
51  virtual bool extract_record(FltRecordReader &reader);
52  virtual bool extract_ancillary(FltRecordReader &reader);
53 
54  virtual bool build_record(FltRecordWriter &writer) const;
55  virtual FltError write_ancillary(FltRecordWriter &writer) const;
56 
57 private:
58  bool extract_transform_matrix(FltRecordReader &reader);
59  bool extract_replicate_count(FltRecordReader &reader);
60 
61  FltError write_transform(FltRecordWriter &writer) const;
62  FltError write_replicate_count(FltRecordWriter &writer) const;
63 
64 private:
65  bool _has_transform;
66  LMatrix4d _transform;
67 
69  Transforms _transform_steps;
70 
71  int _replicate_count;
72 
73 public:
74  virtual TypeHandle get_type() const {
75  return get_class_type();
76  }
77  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
78  static TypeHandle get_class_type() {
79  return _type_handle;
80  }
81  static void init_type() {
82  FltRecord::init_type();
83  register_type(_type_handle, "FltBead",
84  FltRecord::get_class_type());
85  }
86 
87 private:
88  static TypeHandle _type_handle;
89 };
90 
91 #endif
92 
93 
void set_transform(const LMatrix4d &mat)
Replaces the transform matrix on this bead.
Definition: fltBead.cxx:79
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly...
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:4716
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
int get_replicate_count() const
Returns the replicate count of this bead.
Definition: fltBead.cxx:170
FltTransformRecord * get_transform_step(int n)
Returns the nth individual step that defines the net transform on this bead.
Definition: fltBead.cxx:122
void add_transform_step(FltTransformRecord *record)
Applies the indicated transform step to the net transformation applied to the bead.
Definition: fltBead.cxx:149
const LMatrix4d & get_transform() const
Returns the single-precision 4x4 matrix that represents the transform applied to this bead...
Definition: fltBead.cxx:66
A base class for any of a broad family of flt records that represent particular beads in the hierarch...
Definition: fltBead.h:33
int get_num_transform_steps() const
Returns the number of individual steps that define the net transform on this bead as returned by set_...
Definition: fltBead.cxx:110
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:48
bool has_transform() const
Returns true if the bead has been transformed, false otherwise.
Definition: fltBead.cxx:54
The base class for all kinds of records in a MultiGen OpenFlight file.
Definition: fltRecord.h:40
void clear_transform()
Removes any transform matrix and all transform steps on this bead.
Definition: fltBead.cxx:93
A base class for a number of types of ancillary records that follow beads and indicate some kind of a...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
void set_replicate_count(int count)
Changes the replicate count of this bead.
Definition: fltBead.cxx:183