mirror of
https://github.com/mangosfour/server.git
synced 2025-12-19 04:37:06 +00:00
[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.
This commit is contained in:
parent
2fd536fe43
commit
3f913454e4
2 changed files with 7 additions and 5 deletions
|
|
@ -137,12 +137,14 @@ namespace VMAP
|
||||||
// child bounds are defined in object space:
|
// child bounds are defined in object space:
|
||||||
Vector3 pModel = iInvRot * (p - iPos) * iInvScale;
|
Vector3 pModel = iInvRot * (p - iPos) * iInvScale;
|
||||||
//Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f);
|
//Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f);
|
||||||
float zDist;
|
float zLevel;
|
||||||
if (info.hitModel->GetLiquidLevel(pModel, zDist))
|
if (info.hitModel->GetLiquidLevel(pModel, zLevel))
|
||||||
{
|
{
|
||||||
// calculate world height (zDist in model coords):
|
// calculate world height (zDist in model coords):
|
||||||
// assume WMO not tilted (wouldn't make much sense anyway)
|
// despite making little sense, there ARE some (slightly) tilted WMOs...
|
||||||
liqHeight = zDist * iScale + iPos.z;
|
// 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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11077"
|
#define REVISION_NR "11078"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue