Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
transform.h
1 #pragma once
2 
3 #include <glm/glm.hpp>
4 #include <glm/gtc/quaternion.hpp>
5 
6 
7 /* General Object in our 3D world with position and orientation
8 */
9 class Transform {
10 
11 public:
12  Transform(glm::vec3 center = glm::vec3(0), float scale = 1.0);
13  Transform(const Transform& transform, const glm::vec3& positionDelta, const glm::quat& orientationDelta);
14  virtual ~Transform();
15 
16  const glm::vec3 &position() const;
17  void setPosition(const glm::vec3 &pos);
18 
19  const glm::quat& orientation() const;
20  void setOrientation(const glm::quat& quat);
21 
22  const glm::vec3& center() const;
23  void setCenter(const glm::vec3& center);
24  void setCenterAndAdjustPosition(const glm::vec3& newCenter);
25 
26  float scale() const;
27  void setScale(float scale);
28 
29  void move(const glm::vec3& dist);
30  void moveWorld(const glm::vec3& dist);
31 
32  void rotate(const glm::quat &qrot);
33  void rotateWorld(const glm::quat &qrot);
34 
35  bool operator==(const Transform &other) const;
36  bool operator!=(const Transform &other) const;
37 
38  const glm::mat4 matrix() const;
39 
40  glm::vec3 applyTo(const glm::vec3 &vertex) const;
41  glm::vec3 inverseApplyTo(const glm::vec3 &vertex) const;
42 
43 
44 
45 protected:
46  glm::vec3 m_position;
47  glm::quat m_orientation;
48  glm::vec3 m_center;
49  float m_scale;
50 
51 };
52 
Definition: transform.h:9