Panda3D
 All Classes Functions Variables Enumerations
stTransform.h
1 // Filename: stTransform.h
2 // Created by: drose (06Oct10)
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 STTRANSFORM_H
16 #define STTRANSFORM_H
17 
18 #include "pandabase.h"
19 #include "transformState.h"
20 #include "speedtree_api.h"
21 #include "deg_2_rad.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : STTransform
25 // Description : Represents a transform that may be applied to a
26 // particular instance of a tree when added to the
27 // SpeedTreeNode.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_PANDASPEEDTREE STTransform {
30 PUBLISHED:
31  INLINE STTransform();
32  STTransform(const TransformState *trans);
33  INLINE STTransform(const LPoint3 &pos, PN_stdfloat rotate = 0.0f, PN_stdfloat scale = 1.0f);
34  INLINE STTransform(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat rotate, PN_stdfloat scale);
35  INLINE STTransform(const STTransform &copy);
36  INLINE void operator = (const STTransform &copy);
37 
38 public:
39  INLINE STTransform(const SpeedTree::CInstance &instance);
40  INLINE operator SpeedTree::CInstance () const;
41  INLINE operator CPT(TransformState) () const;
42 
43 PUBLISHED:
44  INLINE static const STTransform &ident_mat();
45 
46  INLINE void set_pos(const LPoint3 &pos);
47  INLINE const LPoint3 &get_pos() const;
48  INLINE void set_rotate(PN_stdfloat rotate);
49  INLINE PN_stdfloat get_rotate() const;
50  INLINE void set_scale(PN_stdfloat scale);
51  INLINE PN_stdfloat get_scale() const;
52 
53  INLINE void operator *= (const STTransform &other);
54  INLINE STTransform operator * (const STTransform &other) const;
55 
56  void output(ostream &out) const;
57 
58 public:
59  void write_datagram(BamWriter *manager, Datagram &dg);
60  void fillin(DatagramIterator &scan, BamReader *manager);
61 
62 public:
63  LPoint3 _pos;
64  PN_stdfloat _rotate;
65  PN_stdfloat _scale;
66 
67  static STTransform _ident_mat;
68 };
69 
70 INLINE ostream &operator << (ostream &out, const STTransform &transform) {
71  transform.output(out);
72  return out;
73 }
74 
75 #include "stTransform.I"
76 
77 #endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
Represents a transform that may be applied to a particular instance of a tree when added to the Speed...
Definition: stTransform.h:29
A class to retrieve the individual data elements previously stored in a Datagram. ...
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43