-
Notifications
You must be signed in to change notification settings - Fork 23
/
PhysicsScene.h
43 lines (29 loc) · 1.39 KB
/
PhysicsScene.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include <G3D/G3D.h>
class PhysicsScene : public Scene {
protected:
Vector3 m_gravity;
float m_resetHeight = fnan();
/** Polygons of all non-dynamic entitys */
shared_ptr<TriTree> m_collisionTree;
PhysicsScene(const shared_ptr<AmbientOcclusion>& ao) : Scene(ao) {
m_collisionTree = TriTree::create(false);
}
public:
static shared_ptr<PhysicsScene> create(const shared_ptr<AmbientOcclusion>& ao);
void poseExceptExcluded(Array<shared_ptr<Surface> >& surfaceArray, const String& excludedEntity);
void setGravity(const Vector3& newGravity) { m_gravity = newGravity; }
void setResetHeight(const float resetHeight) { m_resetHeight = resetHeight; }
float resetHeight() { return m_resetHeight; }
Vector3 gravity() const { return m_gravity; }
/** Extend to read in physics properties */
virtual Any load(const String& sceneName, const LoadOptions& loadOptions = LoadOptions()) override;
/** Gets all static triangles within this world-space sphere. */
void staticIntersectSphere(const Sphere& sphere, Array<Tri>& triArray) const;
/** Gets all static triangles within this world-space box. */
void staticIntersectBox(const AABox& box, Array<Tri>& triArray) const;
const CPUVertexArray& vertexArrayOfCollisionTree() const {
return m_collisionTree->vertexArray();
}
Any toAny() const;
};