From 3f913454e4b259344e7337f378c559d7df4451e1 Mon Sep 17 00:00:00 2001 From: Lynx3d Date: Sat, 29 Jan 2011 03:40:35 +0100 Subject: [PATCH] [11078] Implement a better approximation for vmap liquid levels with 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. --- src/game/vmap/ModelInstance.cpp | 10 ++++++---- src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/game/vmap/ModelInstance.cpp b/src/game/vmap/ModelInstance.cpp index c3116ccc6..0ea31414f 100644 --- a/src/game/vmap/ModelInstance.cpp +++ b/src/game/vmap/ModelInstance.cpp @@ -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; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3bd9e1bf5..27f074441 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11077" + #define REVISION_NR "11078" #endif // __REVISION_NR_H__