-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCHavokManager.h
64 lines (57 loc) · 1.71 KB
/
CHavokManager.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef HAVOKMANAGER
#define HAVOKMANAGER
class HavokSampledHeightMap : public hkpSampledHeightFieldShape
{
public:
HavokSampledHeightMap(const hkpSampledHeightFieldBaseCinfo& ci,float *_land_heights) : hkpSampledHeightFieldShape(ci)
{
land_heights=_land_heights;
}
virtual void collideSpheres( const CollideSpheresInput& input, SphereCollisionOutput* outputArray) const
{
return hkSampledHeightFieldShape_collideSpheres(*this, input, outputArray);
}
HK_FORCE_INLINE hkReal getHeightAtImpl( int x, int z ) const
{
return land_heights[(z*m_xRes)+x];
}
HK_FORCE_INLINE hkBool getTriangleFlipImpl() const { return false; }
protected:
float *land_heights;
};
class CHavokManager
{
public:
//Constructors and Destructors(empty atm)
CHavokManager();
~CHavokManager();
//The initialization
void Init();
//Step the physics world
void UpdateHavokState();
//Add a rigid body to the physics world
void AddRigidBody(hkpRigidBody *);
//Setup the character
void SetupCharacterProxy();
//Create a rigid body from landscape
hkpRigidBody *CreateLandscapeRigid(float *,float,float);
//Create a hkMemoryRouter for a thread
void CreateThreadMemoryRouter(hkMemoryRouter &);
protected:
//Hardware havok stuff
hkJobThreadPool* threadPool;
hkJobQueue* jobQueue;
//The magical world where physics become true
hkpWorld* physicsWorld;
//The phantom of the character
hkpShapePhantom* m_char_phantom;
//The character proxy
hkpCharacterProxy* m_characterProxy;
//Shape of standing character
hkpShape* m_standShape;
//Not sure what this is...
hkpCharacterContext* m_characterContext;
//Critical section for the havok world
CRITICAL_SECTION *crit_hkWorld;
};
#endif