1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Adrian Buerli |
---|
13 | */ |
---|
14 | |
---|
15 | #include <iostream> |
---|
16 | |
---|
17 | #include "IPhys.h" |
---|
18 | #include "stdincl.h" |
---|
19 | |
---|
20 | using namespace std; |
---|
21 | |
---|
22 | IPhys::IPhys () |
---|
23 | { |
---|
24 | } |
---|
25 | |
---|
26 | IPhys::~IPhys () |
---|
27 | { |
---|
28 | } |
---|
29 | |
---|
30 | // Simulation |
---|
31 | void IPhys::simIterate(Uint32 deltaT){ |
---|
32 | switch (behav) { |
---|
33 | case B_MASS_POINT: |
---|
34 | break; |
---|
35 | case B_RIGID_BODY: |
---|
36 | break; |
---|
37 | case B_ELAST_BODY: |
---|
38 | break; |
---|
39 | case I_SPRING_LINEAR: |
---|
40 | break; |
---|
41 | case I_DMPSPR_LINEAR: |
---|
42 | break; |
---|
43 | case I_SPRING_MOMENTUM: |
---|
44 | break; |
---|
45 | case I_DMPSPR_MOMENTUM: |
---|
46 | break; |
---|
47 | case F_GRAVITY: |
---|
48 | break; |
---|
49 | case F_HOVER: |
---|
50 | break; |
---|
51 | case F_SHOCKWAVE: |
---|
52 | break; |
---|
53 | case F_BEAM: |
---|
54 | break; |
---|
55 | default:; |
---|
56 | } |
---|
57 | }; |
---|
58 | |
---|
59 | |
---|
60 | // Exertion of external forces |
---|
61 | void IPhys::exertForce( Vector force ){ |
---|
62 | resForce = resForce + force; |
---|
63 | }; |
---|
64 | |
---|
65 | void IPhys::exertMomentum( Vector Momentum ){ |
---|
66 | resMomentum = resMomentum + Momentum; |
---|
67 | }; |
---|
68 | |
---|
69 | // set attributes |
---|
70 | void IPhys::setBehaviour( IPHYS_BEHAVIOUR desiredBehaviour ){ |
---|
71 | behav = desiredBehaviour; |
---|
72 | }; |
---|
73 | |
---|
74 | void IPhys::setBody( float mass ){ |
---|
75 | m = mass; |
---|
76 | }; |
---|
77 | |
---|
78 | void IPhys::setBody( float mass, float inertMoment[] ){ |
---|
79 | m = mass; |
---|
80 | //inertM = inertMoment; |
---|
81 | }; |
---|
82 | |
---|
83 | void IPhys::setBody( float mass, float inertMoment[], float YoungsModulus ){ |
---|
84 | m = mass; |
---|
85 | //inertM = inertMoment; |
---|
86 | YE = YoungsModulus; |
---|
87 | }; |
---|
88 | |
---|
89 | void IPhys::setMounts( WorldEntity *point1, WorldEntity *point2 ){ |
---|
90 | mounts[0] = point1; |
---|
91 | mounts[1] = point2; |
---|
92 | }; |
---|
93 | |
---|
94 | void IPhys::setSpring( float neutralLength, float springConst ){ |
---|
95 | spNeutralL = neutralLength; |
---|
96 | spConst = springConst; |
---|
97 | }; |
---|
98 | |
---|
99 | void IPhys::setSpring( float neutralLength, float springConst, float damping ){ |
---|
100 | spNeutralL = neutralLength; |
---|
101 | spConst = springConst; |
---|
102 | dmp = damping; |
---|
103 | }; |
---|
104 | |
---|
105 | void IPhys::setSpring( Quaternion neutralOrientation, float springConst ){ |
---|
106 | mspNeutralOri = neutralOrientation; |
---|
107 | spConst = springConst; |
---|
108 | }; |
---|
109 | void IPhys::setSpring( Quaternion neutralOrientation, float springConst, float damping ){ |
---|
110 | mspNeutralOri = neutralOrientation; |
---|
111 | spConst = springConst; |
---|
112 | dmp = damping; |
---|
113 | }; |
---|
114 | |
---|
115 | |
---|