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
65
66
67
68
69
70
71
72
|
#pragma once
#include "Runtime/Math/Vector3.h"
#include "Runtime/Math/Quaternion.h"
#include "Runtime/Utilities/NonCopyable.h"
#include "Runtime/Scripting/ScriptingUtility.h"
class Rigidbody;
struct PhysicsStats;
class NxTriangleMesh;
class NxConvexMesh;
class NxStream;
class CapsuleCollider;
struct Collision;
namespace Unity { class SkinnedCloth; }
class Collider;
class MeshCollider;
class NxConvexMeshDesc;
class NxTriangleMeshDesc;
class MemoryStream;
class Mesh;
class NxHeightField;
class NxHeightFieldDesc;
class EXPORT_COREMODULE IPhysics : public NonCopyable
{
public:
// Collision intersection
struct RigidBodyState
{
Vector3f position;
Quaternionf rotation;
Vector3f velocity;
Vector3f avelocity;
};
virtual void SetRigidBodyState( Rigidbody& rigidbody, const RigidBodyState& state ) = 0;
virtual void GetRigidBodyState( const Rigidbody& rigidbody, RigidBodyState* result) = 0;
virtual Vector3f GetRigidBodyVelocity( const Rigidbody& rigidbody) = 0;
virtual Vector3f GetGravity() = 0;
virtual void* CreateNxMeshFromNxStream(bool convex, const NxStream& stream) = 0;
virtual void ReleaseNxTriangleMesh(NxTriangleMesh& mesh) = 0;
virtual void ReleaseNxConvexMesh(NxConvexMesh& mesh) = 0;
virtual void CapsuleColliderSetHeight(CapsuleCollider& collider, float height) = 0;
virtual ScriptingObjectPtr ConvertContactToMono (Collision* input) = 0;
virtual int GetColliderMaterialInstanceID(Collider& collider) = 0;
virtual int GetColliderSharedMeshInstanceID(MeshCollider& collider) = 0;
virtual bool CreateNxStreamFromUnityMesh (Mesh* mesh, bool convex, const Matrix4x4f& scalematrix, TransformType transformType, MemoryStream& stream ) = 0;
virtual void* CreateNxMeshFromUnityMesh (Mesh* mesh, bool convex, const Matrix4x4f& scalematrix, TransformType transformType ) = 0;
virtual MemoryStream* CreateNxStreamFromUnityMesh(Mesh& meshData, bool convex) = 0;
virtual void DeleteMemoryStream(MemoryStream* memory) = 0;
virtual void ReleaseHeightField(NxHeightField& heightField) = 0;
virtual NxHeightField* CreateNxHeightField(NxHeightFieldDesc& desc) = 0;
#if ENABLE_CLOTH
virtual void SetUpSkinnedBuffersOnSkinnedCloth (Unity::SkinnedCloth& cloth, void *vertices, void *normals, void *tangents, size_t bufferStride) = 0;
#endif
#if ENABLE_PROFILER
virtual void GetProfilerStats(PhysicsStats& stats) = 0;
#endif
};
EXPORT_COREMODULE IPhysics* GetIPhysics();
EXPORT_COREMODULE void SetIPhysics(IPhysics* physics);
|