Panda3D

fltTransformRotateScale.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 fltTransformRotateScale.h
10 * @author drose
11 * @date 2000-08-30
12 */
13
14 #ifndef FLTTRANSFORMROTATESCALE_H
15 #define FLTTRANSFORMROTATESCALE_H
16
17 #include "pandatoolbase.h"
18
19 #include "fltTransformRecord.h"
20
21 /**
22 * A combination rotation and scale. This is sometimes called "Rotate To
23 * Point" within MultiGen.
24 */
25 class FltTransformRotateScale : public FltTransformRecord {
26 public:
27 FltTransformRotateScale(FltHeader *header);
28
29 void set(const LPoint3d &center, const LPoint3d &reference_point,
30 const LPoint3d &to_point, bool axis_scale);
31
32 const LPoint3d &get_center() const;
33 const LPoint3d &get_reference_point() const;
34 const LPoint3d &get_to_point() const;
35 PN_stdfloat get_overall_scale() const;
36 PN_stdfloat get_axis_scale() const;
37 PN_stdfloat get_angle() const;
38
39 private:
40 void recompute_matrix();
41
42 LPoint3d _center;
43 LPoint3d _reference_point;
44 LPoint3d _to_point;
45 PN_stdfloat _overall_scale;
46 PN_stdfloat _axis_scale;
47 PN_stdfloat _angle;
48
49 protected:
50 virtual bool extract_record(FltRecordReader &reader);
51 virtual bool build_record(FltRecordWriter &writer) const;
52
53 public:
54 virtual TypeHandle get_type() const {
55 return get_class_type();
56 }
57 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
58 static TypeHandle get_class_type() {
59 return _type_handle;
60 }
61 static void init_type() {
62 FltTransformRecord::init_type();
63 register_type(_type_handle, "FltTransformRotateScale",
64 FltTransformRecord::get_class_type());
65 }
66
67 private:
68 static TypeHandle _type_handle;
69 };
70
71 #endif
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
FltTransformRotateScale
A combination rotation and scale.
Definition: fltTransformRotateScale.h:25
FltTransformRotateScale::get_axis_scale
PN_stdfloat get_axis_scale() const
Returns the scale factor in the direction of the axis.
Definition: fltTransformRotateScale.cxx:103
FltTransformRotateScale::get_angle
PN_stdfloat get_angle() const
Returns the angle of rotation in degrees.
Definition: fltTransformRotateScale.cxx:111
FltTransformRotateScale::set
void set(const LPoint3d &center, const LPoint3d &reference_point, const LPoint3d &to_point, bool axis_scale)
Defines the transform explicitly.
Definition: fltTransformRotateScale.cxx:44
FltTransformRotateScale::get_overall_scale
PN_stdfloat get_overall_scale() const
Returns the overall scale factor.
Definition: fltTransformRotateScale.cxx:95
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
fltTransformRecord.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