ScummVM API documentation
PhysicsWorldNewton.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_PHYSICS_WORLD_NEWTON_H
29#define HPL_PHYSICS_WORLD_NEWTON_H
30
31#include "hpl1/engine/physics/PhysicsWorld.h"
32
33#include "hpl1/engine/libraries/newton/Newton.h"
34
35namespace hpl {
37public:
40
41 void Simulate(float afTimeStep);
42
43 void SetMaxTimeStep(float afTimeStep);
44 float GetMaxTimeStep();
45
46 void SetWorldSize(const cVector3f &avMin, const cVector3f &avMax);
47 cVector3f GetWorldSizeMin();
48 cVector3f GetWorldSizeMax();
49
50 void SetGravity(const cVector3f &avGravity);
51 cVector3f GetGravity();
52
53 void SetAccuracyLevel(ePhysicsAccuracy aAccuracy);
54 ePhysicsAccuracy GetAccuracyLevel();
55
56 iCollideShape *CreateNullShape();
57 iCollideShape *CreateBoxShape(const cVector3f &avSize, cMatrixf *apOffsetMtx);
58 iCollideShape *CreateSphereShape(const cVector3f &avRadii, cMatrixf *apOffsetMtx);
59 iCollideShape *CreateCylinderShape(float afRadius, float afHeight, cMatrixf *apOffsetMtx);
60 iCollideShape *CreateCapsuleShape(float afRadius, float afHeight, cMatrixf *apOffsetMtx);
61 iCollideShape *CreateMeshShape(iVertexBuffer *apVtxBuffer);
62 iCollideShape *CreateCompundShape(tCollideShapeVec &avShapes);
63
64 iPhysicsJointBall *CreateJointBall(const tString &asName, const cVector3f &avPivotPoint,
65 iPhysicsBody *apParentBody, iPhysicsBody *apChildBody);
66 iPhysicsJointHinge *CreateJointHinge(const tString &asName, const cVector3f &avPivotPoint,
67 const cVector3f &avPinDir,
68 iPhysicsBody *apParentBody, iPhysicsBody *apChildBody);
69 iPhysicsJointSlider *CreateJointSlider(const tString &asName, const cVector3f &avPivotPoint,
70 const cVector3f &avPinDir,
71 iPhysicsBody *apParentBody, iPhysicsBody *apChildBody);
72 iPhysicsJointScrew *CreateJointScrew(const tString &asName, const cVector3f &avPivotPoint,
73 const cVector3f &avPinDir,
74 iPhysicsBody *apParentBody, iPhysicsBody *apChildBody);
75
76 iPhysicsBody *CreateBody(const tString &asName, iCollideShape *apShape);
77
78 iCharacterBody *CreateCharacterBody(const tString &asName, const cVector3f &avSize);
79
80 iPhysicsMaterial *CreateMaterial(const tString &asName);
81
82 iPhysicsController *CreateController(const tString &asName);
83
84 void CastRay(iPhysicsRayCallback *apCallback,
85 const cVector3f &avOrigin, const cVector3f &avEnd,
86 bool abCalcDist, bool abCalcNormal, bool abCalcPoint,
87 bool abUsePrefilter = false);
88
89 bool CheckShapeCollision(iCollideShape *apShapeA, const cMatrixf &a_mtxA,
90 iCollideShape *apShapeB, const cMatrixf &a_mtxB,
91 cCollideData &aCollideData, int alMaxPoints, bool correctNormalDirection = false);
92
93 void RenderDebugGeometry(iLowLevelGraphics *apLowLevel, const cColor &aColor);
94
95 NewtonWorld *GetNewtonWorld() { return mpNewtonWorld; }
96
97private:
98 NewtonWorld *mpNewtonWorld;
99
100 float *mpTempPoints;
101 float *mpTempNormals;
102 float *mpTempDepths;
103
104 cVector3f mvWorldSizeMin;
105 cVector3f mvWorldSizeMax;
106 cVector3f mvGravity;
107 float mfMaxTimeStep;
108
109 ePhysicsAccuracy mAccuracy;
110};
111
112} // namespace hpl
113
114#endif // HPL_PHYSICS_WORLD_NEWTON_H
Definition: str.h:59
Definition: CollideData.h:46
Definition: Color.h:37
Definition: PhysicsWorldNewton.h:36
Definition: CharacterBody.h:153
Definition: CollideShape.h:50
Definition: LowLevelGraphics.h:200
Definition: PhysicsBody.h:117
Definition: PhysicsController.h:122
Definition: PhysicsJointBall.h:48
Definition: PhysicsJointHinge.h:47
Definition: PhysicsJointScrew.h:48
Definition: PhysicsJointSlider.h:48
Definition: PhysicsMaterial.h:77
Definition: PhysicsWorld.h:100
Definition: PhysicsWorld.h:115
Definition: VertexBuffer.h:90