voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
transform.hpp
1 #ifndef TRANSFORM_HPP
2 #define TRANSFORM_HPP
3 
4 #include "blub/core/globals.hpp"
5 #include "blub/math/vector3.hpp"
6 #include "blub/math/quaternion.hpp"
7 #ifdef BLUB_USE_PHYSX
8 # include <foundation/PxTransform.h>
9 #endif
10 
11 
12 #ifdef BLUB_USE_BULLET
13 class btTransform;
14 #endif
15 
16 
17 namespace blub
18 {
19 
20 class transform
21 {
22 public:
23  transform(const vector3& position_ = vector3(), const quaternion& rotation_ = quaternion(), const vector3& scale_ = vector3(1.));
24  //depricated transform(const transform& other);
25 
26 #ifdef BLUB_USE_PHYSX
27  transform(const physx::PxTransform& other)
28  : position(other.p), rotation(other.q), scale(1.)
29  {}
30  operator physx::PxTransform() const
31  {return physx::PxTransform(position, rotation);}
32 #endif
33 #ifdef BLUB_USE_BULLET
34  transform(const btTransform& other);
35  operator btTransform() const;
36 #endif
37 
38  bool operator ==(const transform& other) const;
39  bool operator !=(const transform& other) const;
40 
41  transform operator +(const transform& other) const;
42 
43  transform getRelativeTo(const transform& other) const;
44 
45 public:
46  vector3 position;
47  quaternion rotation;
48  vector3 scale;
49 
50 protected:
51  BLUB_SERIALIZATION_ACCESS
52  template<typename Archive>
53  void serialize(Archive & readWrite, const unsigned int version)
54  {
55  (void)version;
56 
57  readWrite & BLUB_SERIALIZATION_NAMEVALUEPAIR(position);
58  readWrite & BLUB_SERIALIZATION_NAMEVALUEPAIR(rotation);
59  readWrite & BLUB_SERIALIZATION_NAMEVALUEPAIR(scale);
60  }
61 };
62 
63 
64 std::ostream& operator << (std::ostream& ostr, const blub::transform& toCast);
65 
66 
67 }
68 
69 #endif // TRANSFORM_HPP
Definition: transform.hpp:20
Definition: quaternion.hpp:25
Definition: vector3.hpp:26
Definition: deadlineTimer.hpp:10