Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
physics.h
1 #pragma once
2 
3 #include <list>
4 #include <memory>
5 #include <glm/glm.hpp>
6 
7 #include "geometry/transform.h"
8 #include "geometry/speed.h"
9 #include "geometry/acceleration.h"
10 
11 #include "property/property.h"
12 
13 
14 class WorldObject;
15 class Transform;
16 class Voxel;
17 class VoxelCollision;
18 
19 class Physics {
20 public:
21  Physics(WorldObject& worldObject, float scale);
22 
23  float directionalDampening() const;
24  void setDirectionalDampening(const Property<float>& directionalDampening);
25 
26  float angularDampening() const;
27  void setAngularDampening(const Property<float>& angularDampening);
28 
29  const Speed& speed() const;
30  void setSpeed(const Speed& speed);
31 
32  const Acceleration& acceleration() const;
33  void setAcceleration(const Acceleration& acceleration);
34 
35  float mass() const;
36  float maxMass() const;
37 
38  const Transform projectedTransformIn(float deltaSec);
39 
40  std::list<VoxelCollision>& move(float deltaSec);
41 
42  void addVoxel(Voxel* voxel);
43  void removeVoxel(Voxel* voxel);
44 
45 
46 protected:
47  WorldObject& m_worldObject;
48  Speed m_speed;
49  Acceleration m_acceleration;
50 
51  Property<float> m_directionalDampening;
52  Property<float> m_angularDampening;
53 
54  float m_mass;
55  float m_maxMass;
56  glm::vec3 m_accumulatedMassVec; // For fast recalc of center of mass on voxel addition/removal
57  float m_massScaleFactor;
58 
59  void voxelChanged(Voxel* voxel, bool isAdd);
60  virtual void updateSpeed(float deltaSec);
61 };
62 
Definition: worldobject.h:43
Definition: transform.h:9
Definition: voxel.h:15
Definition: physics.h:19
Definition: voxelcollision.h:22
Definition: abstractmove.h:5