Game Development Reference
In-Depth Information
if (z < ZMin)
{
ZMin = z;
}
// Test for Max
if (x > XMax)
{
XMax = x;
}
if (y > YMax)
{
YMax = y;
}
if (z > ZMax)
{
ZMax = z;
}
ElementPos = ElementPos + m_CoordsPerVertex;
}
// Calculate Size of Mesh in the x,y,z directions
m_Size.x = Math.abs(XMax - XMin);
m_Size.y = Math.abs(YMax - YMin);
m_Size.z = Math.abs(ZMax - ZMin);
// Calculate Radius
float LargestSize = -1;
if (m_Size.x > LargestSize)
{
LargestSize = m_Size.x;
}
if (m_Size.y > LargestSize)
{
LargestSize = m_Size.y;
}
if (m_Size.z > LargestSize)
{
LargestSize = m_Size.z;
}
m_Radius = LargestSize/2.0f;
// Calculate Average Radius;
m_RadiusAverage = (m_Size.x + m_Size.y + m_Size.z) / 3.0f;
m_RadiusAverage = m_RadiusAverage/2.0f;
}
 
Search WWH ::




Custom Search