ScummVM API documentation
PhysicsMaterial.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_MATERIAL_H
29 #define HPL_PHYSICS_MATERIAL_H
30 
31 #include "hpl1/engine/math/MathTypes.h"
32 
33 namespace hpl {
34 
35 class iPhysicsWorld;
36 class cSurfaceData;
37 
38 //----------------------------------------------------
39 
43 enum ePhysicsMaterialCombMode {
45  ePhysicsMaterialCombMode_Average = 0,
47  ePhysicsMaterialCombMode_Min = 1,
49  ePhysicsMaterialCombMode_Multiply = 2,
51  ePhysicsMaterialCombMode_Max = 3,
53  ePhysicsMaterialCombMode_LastEnum
54 };
55 
56 //----------------------------------------------------
57 
59 public:
61  mfMaxContactNormalSpeed = 0;
62  mfMaxContactTangentSpeed = 0;
63  mvContactNormal = cVector3f(0, 0, 0);
64  mvContactPosition = cVector3f(0, 0, 0);
65  mvForce = cVector3f(0, 0, 0);
66  }
67 
68  float mfMaxContactNormalSpeed;
69  float mfMaxContactTangentSpeed;
70  cVector3f mvContactNormal;
71  cVector3f mvContactPosition;
72  cVector3f mvForce;
73 };
74 
75 //----------------------------------------------------
76 
78 public:
79  iPhysicsMaterial(const tString &asName, iPhysicsWorld *apWorld)
80  : msName(asName), mpWorld(apWorld), mpSurfaceData(NULL),
81  mbPreloaded(false) {}
82  virtual ~iPhysicsMaterial() {}
83 
84  const tString &GetName() const { return msName; }
85 
86  virtual void SetElasticity(float afElasticity) = 0;
87  virtual float GetElasticity() const = 0;
88  virtual void SetStaticFriction(float afElasticity) = 0;
89  virtual float GetStaticFriction() const = 0;
90  virtual void SetKineticFriction(float afElasticity) = 0;
91  virtual float GetKineticFriction() const = 0;
92 
93  virtual void SetFrictionCombMode(ePhysicsMaterialCombMode aMode) = 0;
94  virtual ePhysicsMaterialCombMode GetFrictionCombMode() const = 0;
95  virtual void SetElasticityCombMode(ePhysicsMaterialCombMode aMode) = 0;
96  virtual ePhysicsMaterialCombMode GetElasticityCombMode() const = 0;
97 
98  void SetSurfaceData(cSurfaceData *apData) { mpSurfaceData = apData; }
99  cSurfaceData *GetSurfaceData() { return mpSurfaceData; }
100 
101  void SetPreloaded(bool abX) { mbPreloaded = abX; }
102  bool IsPreloaded() { return mbPreloaded; }
103 
104 protected:
105  iPhysicsWorld *mpWorld;
106  tString msName;
107 
108  bool mbPreloaded;
109 
110  cSurfaceData *mpSurfaceData;
111 };
112 
113 } // namespace hpl
114 
115 #endif // HPL_PHYSICS_MATERIAL_H
Definition: AI.h:36
Definition: str.h:59
Definition: PhysicsWorld.h:115
Definition: SurfaceData.h:74
Definition: PhysicsMaterial.h:77
Definition: PhysicsMaterial.h:58