mirror of
https://bitbucket.org/seefoe/src.git
synced 2026-10-20 10:02:57 -04:00
remove SOE deprecated code and files - leaving in the #if 0 blocks with TODO and other possible uses for later
This commit is contained in:
-124
@@ -374,130 +374,6 @@ bool SamplerProceduralTerrainAppearance::SamplerChunk::getHeightAt (const Vector
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
#if 0
|
||||
bool SamplerProceduralTerrainAppearance::SamplerChunk::getHeightAt2(const Vector& pos, float* const height, Vector* const normal) const
|
||||
{
|
||||
// ------------------------------------------------
|
||||
// make sure we're in the chunk
|
||||
const Vector vmin = m_boxExtent.getMin ();
|
||||
const Vector vmax = m_boxExtent.getMax ();
|
||||
if (pos.x < vmin.x || pos.x > vmax.x || pos.z < vmin.z || pos.z > vmax.z)
|
||||
{
|
||||
DEBUG_WARNING (true, ("called getHeightAt for position not within chunk"));
|
||||
return false;
|
||||
}
|
||||
// ------------------------------------------------
|
||||
|
||||
// ------------------------------------------------
|
||||
// get height pole and tile coordinate.
|
||||
const Vector localPos = pos - vmin;
|
||||
|
||||
const ProceduralTerrainAppearanceTemplate *proceduralTerrainAppearanceTemplate = getAppearanceTemplate();
|
||||
const float distanceBetweenPoles = proceduralTerrainAppearanceTemplate->getTileWidthInMeters() / 2.0f;
|
||||
const int numberOfPolesPerChunk = proceduralTerrainAppearanceTemplate->getNumberOfTilesPerChunk() * 2;
|
||||
|
||||
int poleX = int(floor(localPos.x / distanceBetweenPoles));
|
||||
if (poleX>=numberOfPolesPerChunk)
|
||||
{
|
||||
poleX=numberOfPolesPerChunk-1;
|
||||
}
|
||||
|
||||
int poleZ = int(floor(localPos.z / distanceBetweenPoles));
|
||||
if (poleZ>=numberOfPolesPerChunk)
|
||||
{
|
||||
poleZ=numberOfPolesPerChunk-1;
|
||||
}
|
||||
|
||||
const int tileX = poleX>>1;
|
||||
const int tileZ = poleZ>>1;
|
||||
// ------------------------------------------------
|
||||
|
||||
// ------------------------------------------------
|
||||
// if the tile at x,z is excluded, return failure.
|
||||
|
||||
// DEBUG
|
||||
{
|
||||
int dbgTileX, dbgTileZ;
|
||||
_findTileXz(pos, dbgTileX, dbgTileZ);
|
||||
DEBUG_FATAL(dbgTileX!=tileX, (""));
|
||||
DEBUG_FATAL(dbgTileZ!=tileZ, (""));
|
||||
}
|
||||
|
||||
if (isExcluded(tileX, tileZ))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// ------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------
|
||||
// construct vertical vector at x,z that goes
|
||||
// from the highest point in the chunk to the
|
||||
// lowest point in the chunk.
|
||||
const Vector start(pos.x, vmax.y + 0.1f, pos.z);
|
||||
const Vector end(pos.x, vmin.y - 0.1f, pos.z);
|
||||
const Vector dir = end - start;
|
||||
// ------------------------------------------------
|
||||
|
||||
//-- collide with the 8 polygons in the tile
|
||||
bool found = false;
|
||||
|
||||
CollisionInfo result;
|
||||
result.setPoint (end);
|
||||
|
||||
Vector intersection;
|
||||
|
||||
const int numberOfTilesPerChunk = m_proceduralTerrainAppearance.getNumberOfTilesPerChunk();
|
||||
const int tileIndex = tileZ * numberOfTilesPerChunk + tileX;
|
||||
const int triangleOffset = tileIndex * 8;
|
||||
for (int tri = triangleOffset; tri < triangleOffset + 8; ++tri)
|
||||
{
|
||||
const Plane& plane = (*m_planeList) [tri];
|
||||
const Vector& normal = plane.getNormal ();
|
||||
|
||||
if ( dir.dot(normal)<0.f // if triangle is facing upward
|
||||
&& plane.findIntersection(start, end, intersection)
|
||||
)
|
||||
{
|
||||
const int i0 = (*ms_indexList)[tri*3 + 0];
|
||||
const int i1 = (*ms_indexList)[tri*3 + 1];
|
||||
const int i2 = (*ms_indexList)[tri*3 + 2];
|
||||
|
||||
const Vector& v0 = (*m_vertexList)[i0];
|
||||
const Vector& v1 = (*m_vertexList)[i1];
|
||||
const Vector& v2 = (*m_vertexList)[i2];
|
||||
|
||||
DenormalizedLine2d const line01 (Vector2d (v0.x, v0.z), Vector2d (v1.x, v1.z));
|
||||
DenormalizedLine2d const line12 (Vector2d (v1.x, v1.z), Vector2d (v2.x, v2.z));
|
||||
DenormalizedLine2d const line20 (Vector2d (v2.x, v2.z), Vector2d (v0.x, v0.z));
|
||||
|
||||
if (line01.computeDistanceTo (Vector2d (start.x, start.z)) <= 0 &&
|
||||
line12.computeDistanceTo (Vector2d (start.x, start.z)) <= 0 &&
|
||||
line20.computeDistanceTo (Vector2d (start.x, start.z)) <= 0)
|
||||
{
|
||||
found = true;
|
||||
|
||||
result.setPoint (intersection);
|
||||
result.setNormal (normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
if (height)
|
||||
*height = result.getPoint ().y;
|
||||
|
||||
if (normal)
|
||||
*normal = result.getNormal ();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
#define ALLOW_BACKFACING_COLLISION 0
|
||||
|
||||
@@ -209,25 +209,4 @@ float CoordinateHash::makeFloat(unsigned long hash)
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
long CoordinateHash::hashTuple(float x, float z)
|
||||
{
|
||||
const unsigned long ix = (*(unsigned long *)&x)^0x5a5a5a5a;
|
||||
const unsigned long iz = (*(unsigned long *)&z)^0xa5a5a5a5;
|
||||
const unsigned long hx = _hash1((ix>>8) | (ix<<24));
|
||||
const unsigned long hz = _hash1((iz>>16) | (iz<<16));
|
||||
const unsigned long hmix1 = hx^hz;
|
||||
const unsigned long h = hmix1;
|
||||
|
||||
/*
|
||||
FastRandomGenerator rngx(hx);
|
||||
FastRandomGenerator rngz(hz);
|
||||
const long rnx = rngx.random();
|
||||
const long rnz = rngz.random();
|
||||
return rnx^rnz;
|
||||
*/
|
||||
|
||||
return h;
|
||||
}
|
||||
#endif
|
||||
//===================================================================
|
||||
|
||||
Reference in New Issue
Block a user