Skip to content

Commit

Permalink
[11078] Implement a better approximation for vmap liquid levels with …
Browse files Browse the repository at this point in the history
…diverging "up" directions.

Okay, so game designers CAN fool gravity...I bet they can tilt their cup without spilling the coffee IRL too :p
Only way to do it precisely would be to generate a polygon mesh from the height map and resort to (much slower) raytracing.
  • Loading branch information
Lynx3d committed Jan 29, 2011
1 parent e506b15 commit c1a7f4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/game/vmap/ModelInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ namespace VMAP
// child bounds are defined in object space:
Vector3 pModel = iInvRot * (p - iPos) * iInvScale;
//Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f);
float zDist;
if (info.hitModel->GetLiquidLevel(pModel, zDist))
float zLevel;
if (info.hitModel->GetLiquidLevel(pModel, zLevel))
{
// calculate world height (zDist in model coords):
// assume WMO not tilted (wouldn't make much sense anyway)
liqHeight = zDist * iScale + iPos.z;
// despite making little sense, there ARE some (slightly) tilted WMOs...
// we can only determine liquid height in LOCAL z-direction (heightmap data),
// so with increasing tilt, liquid calculation gets increasingly wrong...not my fault, really :p
liqHeight = (zLevel - pModel.z) * iScale + p.z;
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11077"
#define REVISION_NR "11078"
#endif // __REVISION_NR_H__

0 comments on commit c1a7f4e

Please sign in to comment.