50 return bcn.nodenum == n->pos;
66 return ((a - o).dotProduct((b - o).crossProduct(c - o))) / 6.0;
73 Vec3 normal = (b - a).crossProduct(c - a);
74 float surf = normal.
length();
77 normal = normal / surf;
87 Vec3 ctd = (a + b + c + ap + bp + cp) / 6.0;
104 Vec3 tc = (a + b + c) / 3.0;
106 float vell = vel.
length();
109 float cosaoa = fabs(normal.
dotProduct(vel / vell));
111 drg = (-500.0 * surf * vell * vell * cosaoa) * normal;
116 float fxl = vell * cosaoa * surf;
119 Vec3 fxdir = fxl * normal;
142 return vol * normal + drg;
150 if (a.
y > wha && b.
y > wha && c.
y > wha)
153 if (a.
y > wha || b.
y > wha || c.
y > wha)
157 if (a.
y < wha && b.
y > wha && c.
y > wha)
161 if (b.
y < wha && c.
y > wha && a.
y > wha)
165 if (c.
y < wha && a.
y > wha && b.
y > wha)
170 if (a.
y > wha && b.
y < wha && c.
y < wha)
172 Vec3 tb = a + (wha - a.
y) / (b.
y - a.
y) * (b - a);
173 Vec3 tc = a + (wha - a.
y) / (c.
y - a.
y) * (c - a);
177 if (b.
y > wha && c.
y < wha && a.
y < wha)
179 Vec3 tc = b + (wha - b.
y) / (c.
y - b.
y) * (c - b);
180 Vec3 ta = b + (wha - b.
y) / (a.
y - b.
y) * (a - b);
184 if (c.
y > wha && a.
y < wha && b.
y < wha)
186 Vec3 ta = c + (wha - c.
y) / (a.
y - c.
y) * (a - c);
187 Vec3 tb = c + (wha - c.
y) / (b.
y - c.
y) * (b - c);
Central state/object manager and communications hub.
Game state manager and message-queue provider.
Core data structures for simulation; Everything affected by by either physics, network or user intera...
std::vector< BuoyDebugSubCab > buoy_debug_subcabs
std::vector< BuoyCachedNode > buoy_cached_nodes
BuoyCachedNodeID_t cacheBuoycabNode(node_t *n)
try adding the node to internal list (each node is only listed once).
Buoyance(DustPool *splash, DustPool *ripple)
Vec3 computePressureForce(Vec3 a, Vec3 b, Vec3 c, Vec3 vel, int type)
Vec3 computePressureForceSub(Vec3 a, Vec3 b, Vec3 c, Vec3 vel, int type)
void computeNodeForce(BuoyCachedNode *a, BuoyCachedNode *b, BuoyCachedNode *c, int type, float timeshift)
float computeVolume(Vec3 o, Vec3 a, Vec3 b, Vec3 c)
void malloc(Ogre::Vector3 pos, Ogre::Vector3 vel, Ogre::ColourValue col=Ogre::ColourValue(0.83, 0.71, 0.64, 1.0))
const TerrainPtr & GetTerrain()
Vec3 CalcWavesVelocity(Vec3 pos, float timeshift_sec=0.f)
float CalcWavesHeight(Vec3 pos, float timeshift_sec=0.f)
GameContext * GetGameContext()
Designed to work smoothly with optimizations disabled.
float dotProduct(const Vec3 &b) const
Physics: A vertex in the softbody structure.
NodeNum_t pos
This node's index in Actor::ar_nodes array.