Panda3D
 All Classes Functions Variables Enumerations
fltTransformRotateScale.h
1 // Filename: fltTransformRotateScale.h
2 // Created by: drose (30Aug00)
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 FLTTRANSFORMROTATESCALE_H
16 #define FLTTRANSFORMROTATESCALE_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "fltTransformRecord.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : FltTransformRotateScale
24 // Description : A combination rotation and scale. This is sometimes
25 // called "Rotate To Point" within MultiGen.
26 ////////////////////////////////////////////////////////////////////
28 public:
30 
31  void set(const LPoint3d &center, const LPoint3d &reference_point,
32  const LPoint3d &to_point, bool axis_scale);
33 
34  const LPoint3d &get_center() const;
35  const LPoint3d &get_reference_point() const;
36  const LPoint3d &get_to_point() const;
37  PN_stdfloat get_overall_scale() const;
38  PN_stdfloat get_axis_scale() const;
39  PN_stdfloat get_angle() const;
40 
41 private:
42  void recompute_matrix();
43 
44  LPoint3d _center;
45  LPoint3d _reference_point;
46  LPoint3d _to_point;
47  PN_stdfloat _overall_scale;
48  PN_stdfloat _axis_scale;
49  PN_stdfloat _angle;
50 
51 protected:
52  virtual bool extract_record(FltRecordReader &reader);
53  virtual bool build_record(FltRecordWriter &writer) const;
54 
55 public:
56  virtual TypeHandle get_type() const {
57  return get_class_type();
58  }
59  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
60  static TypeHandle get_class_type() {
61  return _type_handle;
62  }
63  static void init_type() {
64  FltTransformRecord::init_type();
65  register_type(_type_handle, "FltTransformRotateScale",
66  FltTransformRecord::get_class_type());
67  }
68 
69 private:
70  static TypeHandle _type_handle;
71 };
72 
73 #endif
74 
75 
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly...
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
PN_stdfloat get_angle() const
Returns the angle of rotation in degrees.
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:48
PN_stdfloat get_overall_scale() const
Returns the overall scale factor.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:531
void set(const LPoint3d &center, const LPoint3d &reference_point, const LPoint3d &to_point, bool axis_scale)
Defines the transform explicitly.
A base class for a number of types of ancillary records that follow beads and indicate some kind of a...
A combination rotation and scale.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
PN_stdfloat get_axis_scale() const
Returns the scale factor in the direction of the axis.