Panda3D
stTransform.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 stTransform.h
10  * @author drose
11  * @date 2010-10-06
12  */
13 
14 #ifndef STTRANSFORM_H
15 #define STTRANSFORM_H
16 
17 #include "pandabase.h"
18 #include "transformState.h"
19 #include "speedtree_api.h"
20 #include "deg_2_rad.h"
21 
22 /**
23  * Represents a transform that may be applied to a particular instance of a
24  * tree when added to the SpeedTreeNode.
25  */
26 class EXPCL_PANDASPEEDTREE STTransform {
27 PUBLISHED:
28  INLINE STTransform();
29  STTransform(const TransformState *trans);
30  INLINE STTransform(const LPoint3 &pos, PN_stdfloat rotate = 0.0f, PN_stdfloat scale = 1.0f);
31  INLINE STTransform(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat rotate, PN_stdfloat scale);
32  INLINE STTransform(const STTransform &copy);
33  INLINE void operator = (const STTransform &copy);
34 
35 public:
36  INLINE STTransform(const SpeedTree::CInstance &instance);
37  INLINE operator SpeedTree::CInstance () const;
38  INLINE operator CPT(TransformState) () const;
39 
40 PUBLISHED:
41  INLINE static const STTransform &ident_mat();
42 
43  INLINE void set_pos(const LPoint3 &pos);
44  INLINE const LPoint3 &get_pos() const;
45  INLINE void set_rotate(PN_stdfloat rotate);
46  INLINE PN_stdfloat get_rotate() const;
47  INLINE void set_scale(PN_stdfloat scale);
48  INLINE PN_stdfloat get_scale() const;
49 
50  INLINE void operator *= (const STTransform &other);
51  INLINE STTransform operator * (const STTransform &other) const;
52 
53  void output(std::ostream &out) const;
54 
55 public:
56  void write_datagram(BamWriter *manager, Datagram &dg);
57  void fillin(DatagramIterator &scan, BamReader *manager);
58 
59 public:
60  LPoint3 _pos;
61  PN_stdfloat _rotate;
62  PN_stdfloat _scale;
63 
64  static STTransform _ident_mat;
65 };
66 
67 INLINE std::ostream &operator << (std::ostream &out, const STTransform &transform) {
68  transform.output(out);
69  return out;
70 }
71 
72 #include "stTransform.I"
73 
74 #endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
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:38
Represents a transform that may be applied to a particular instance of a tree when added to the Speed...
Definition: stTransform.h:26
Indicates a coordinate-system transform on vertices.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.