Orxonox  0.0.5 Codename: Arcturus
OgreBulletUtils.h
Go to the documentation of this file.
1 
9 #ifndef _OgreBulletUtils_H__
10 #define _OgreBulletUtils_H__
11 
12 #include "tools/ToolsPrereqs.h"
13 #include <OgreVector3.h>
14 #include <OgreQuaternion.h>
15 #include <OgreColourValue.h>
16 #include <OgreMatrix3.h>
17 #include <OgreMatrix4.h>
18 
19 namespace orxonox
20 {
21  inline btVector3 vector3(const Ogre::Vector3& V)
22  {
23  return btVector3(V.x, V.y, V.z);
24  }
25 
26  inline Ogre::Vector3 vector3(const btVector3& V)
27  {
28  return Ogre::Vector3(V.x(), V.y(), V.z());
29  }
30 
31  inline btQuaternion quaternion(const Ogre::Quaternion& Q)
32  {
33  return btQuaternion(Q.x, Q.y, Q.z, Q.w);
34  }
35 
36  inline Ogre::Quaternion quaternion(const btQuaternion& Q)
37  {
38  return Ogre::Quaternion(Q.w(), Q.x(), Q.y(), Q.z());
39  }
40 
41  inline Ogre::ColourValue colour(const btVector3& color, btScalar alpha)
42  {
43  Ogre::ColourValue c(color.getX(), color.getY(), color.getZ(), alpha);
44  c.saturate();
45  return c;
46  }
47 
48  inline Ogre::Matrix3 matrix3(const btMatrix3x3& matrix)
49  {
50  return Ogre::Matrix3(
51  matrix[0][0], matrix[0][1], matrix[0][2],
52  matrix[1][0], matrix[1][1], matrix[1][2],
53  matrix[2][0], matrix[2][1], matrix[2][2]
54  );
55  }
56 
57  inline Ogre::Matrix4 matrix4(const btTransform& transform)
58  {
59  const btMatrix3x3& rotation = transform.getBasis();
60  const btVector3& translation = transform.getOrigin();
61 
62  Ogre::Matrix4 matrix4 = Ogre::Matrix4(matrix3(rotation));
63  matrix4.setTrans(vector3(translation));
64  return matrix4;
65  }
66 }
67 
68 #endif /* _OgreBulletUtils_H__ */
btQuaternion quaternion(const Ogre::Quaternion &Q)
Definition: OgreBulletUtils.h:31
Shared library macros, enums, constants and forward declarations for the tools module ...
Ogre::Matrix3 matrix3(const btMatrix3x3 &matrix)
Definition: OgreBulletUtils.h:48
Ogre::ColourValue colour(const btVector3 &color, btScalar alpha)
Definition: OgreBulletUtils.h:41
Definition: InputPrereqs.h:74
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Definition: InputPrereqs.h:105
Ogre::Matrix4 matrix4(const btTransform &transform)
Definition: OgreBulletUtils.h:57
btVector3 vector3(const Ogre::Vector3 &V)
Definition: OgreBulletUtils.h:21