Panda3D

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