IndexedSurfacePatch no longer handles duplicate vertices. This is done directly by the reference marching cubes implementation.

This commit is contained in:
David Williams 2008-07-01 21:15:05 +00:00
parent 3ce8e42551
commit 1c2a007d23
5 changed files with 126 additions and 169 deletions

View File

@ -36,7 +36,7 @@ namespace PolyVox
class POLYVOX_API IndexedSurfacePatch class POLYVOX_API IndexedSurfacePatch
{ {
public: public:
IndexedSurfacePatch(bool allowDuplicateVertices); IndexedSurfacePatch();
~IndexedSurfacePatch(); ~IndexedSurfacePatch();
void addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2); void addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2);
@ -52,20 +52,6 @@ namespace PolyVox
public: public:
std::vector<std::uint32_t> m_vecTriangleIndices; std::vector<std::uint32_t> m_vecTriangleIndices;
std::vector<SurfaceVertex> m_vecVertices; std::vector<SurfaceVertex> m_vecVertices;
static std::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
static std::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
static std::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
static std::int32_t noOfVerticesSubmitted;
static std::int32_t noOfVerticesAccepted;
static std::int32_t noOfTrianglesSubmitted;
std::int32_t getIndexFor(const Vector3DFloat& pos);
void setIndexFor(const Vector3DFloat& pos, std::int32_t newIndex);
public:
bool m_AllowDuplicateVertices;
}; };
} }

View File

@ -45,6 +45,9 @@ namespace PolyVox
POLYVOX_API void generateRoughVerticesForSlice(BlockVolumeIterator<std::uint8_t>& volIter, Region& regSlice, const Vector3DFloat& offset, std::uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,std::int32_t vertexIndicesX[],std::int32_t vertexIndicesY[],std::int32_t vertexIndicesZ[]); POLYVOX_API void generateRoughVerticesForSlice(BlockVolumeIterator<std::uint8_t>& volIter, Region& regSlice, const Vector3DFloat& offset, std::uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,std::int32_t vertexIndicesX[],std::int32_t vertexIndicesY[],std::int32_t vertexIndicesZ[]);
POLYVOX_API void generateReferenceMeshDataForRegion(BlockVolume<std::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch); POLYVOX_API void generateReferenceMeshDataForRegion(BlockVolume<std::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
std::int32_t getIndexFor(const Vector3DFloat& pos, std::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
void setIndexFor(const Vector3DFloat& pos, std::int32_t newIndex, std::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
} }
#endif #endif

View File

@ -25,19 +25,8 @@ using namespace std;
namespace PolyVox namespace PolyVox
{ {
int32_t IndexedSurfacePatch::noOfVerticesSubmitted = 0; IndexedSurfacePatch::IndexedSurfacePatch()
int32_t IndexedSurfacePatch::noOfVerticesAccepted = 0;
int32_t IndexedSurfacePatch::noOfTrianglesSubmitted = 0;
int32_t IndexedSurfacePatch::vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
int32_t IndexedSurfacePatch::vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
int32_t IndexedSurfacePatch::vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
IndexedSurfacePatch::IndexedSurfacePatch(bool allowDuplicateVertices)
:m_AllowDuplicateVertices(allowDuplicateVertices)
{ {
memset(vertexIndicesX,0xFF,sizeof(vertexIndicesX)); //0xFF is -1 as two's complement - this may not be portable...
memset(vertexIndicesY,0xFF,sizeof(vertexIndicesY));
memset(vertexIndicesZ,0xFF,sizeof(vertexIndicesZ));
} }
IndexedSurfacePatch::~IndexedSurfacePatch() IndexedSurfacePatch::~IndexedSurfacePatch()
@ -45,54 +34,6 @@ namespace PolyVox
} }
void IndexedSurfacePatch::addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2) void IndexedSurfacePatch::addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2)
{
noOfTrianglesSubmitted++;
noOfVerticesSubmitted += 3;
if(!m_AllowDuplicateVertices)
{
int32_t index = getIndexFor(v0.getPosition());
if(index == -1)
{
m_vecVertices.push_back(v0);
m_vecTriangleIndices.push_back(m_vecVertices.size()-1);
setIndexFor(v0.getPosition(), m_vecVertices.size()-1);
noOfVerticesAccepted++;
}
else
{
m_vecTriangleIndices.push_back(index);
}
index = getIndexFor(v1.getPosition());
if(index == -1)
{
m_vecVertices.push_back(v1);
m_vecTriangleIndices.push_back(m_vecVertices.size()-1);
setIndexFor(v1.getPosition(), m_vecVertices.size()-1);
noOfVerticesAccepted++;
}
else
{
m_vecTriangleIndices.push_back(index);
}
index = getIndexFor(v2.getPosition());
if(index == -1)
{
m_vecVertices.push_back(v2);
m_vecTriangleIndices.push_back(m_vecVertices.size()-1);
setIndexFor(v2.getPosition(), m_vecVertices.size()-1);
noOfVerticesAccepted++;
}
else
{
m_vecTriangleIndices.push_back(index);
}
}
else
{ {
m_vecVertices.push_back(v0); m_vecVertices.push_back(v0);
m_vecTriangleIndices.push_back(m_vecVertices.size()-1); m_vecTriangleIndices.push_back(m_vecVertices.size()-1);
@ -100,9 +41,6 @@ namespace PolyVox
m_vecTriangleIndices.push_back(m_vecVertices.size()-1); m_vecTriangleIndices.push_back(m_vecVertices.size()-1);
m_vecVertices.push_back(v2); m_vecVertices.push_back(v2);
m_vecTriangleIndices.push_back(m_vecVertices.size()-1); m_vecTriangleIndices.push_back(m_vecVertices.size()-1);
noOfVerticesAccepted += 3;
}
} }
void IndexedSurfacePatch::fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<uint32_t>& vecIndices) void IndexedSurfacePatch::fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<uint32_t>& vecIndices)
@ -120,71 +58,6 @@ namespace PolyVox
}*/ }*/
} }
std::int32_t IndexedSurfacePatch::getIndexFor(const Vector3DFloat& pos)
{
assert(pos.getX() >= 0.0f);
assert(pos.getY() >= 0.0f);
assert(pos.getZ() >= 0.0f);
assert(pos.getX() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getY() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getZ() <= POLYVOX_REGION_SIDE_LENGTH);
float xIntPart;
float xFracPart = std::modf(pos.getX(), &xIntPart);
float yIntPart;
float yFracPart = std::modf(pos.getY(), &yIntPart);
float zIntPart;
float zFracPart = std::modf(pos.getZ(), &zIntPart);
//Of all the fractional parts, two should be zero and one should have a value.
if(xFracPart > 0.000001f)
{
return vertexIndicesX[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)];
}
if(yFracPart > 0.000001f)
{
return vertexIndicesY[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)];
}
if(zFracPart > 0.000001f)
{
return vertexIndicesZ[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)];
}
while(true);
}
void IndexedSurfacePatch::setIndexFor(const Vector3DFloat& pos, std::int32_t newIndex)
{
assert(pos.getX() >= 0.0f);
assert(pos.getY() >= 0.0f);
assert(pos.getZ() >= 0.0f);
assert(pos.getX() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getY() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getZ() <= POLYVOX_REGION_SIDE_LENGTH);
assert(newIndex < 10000);
float xIntPart;
float xFracPart = std::modf(pos.getX(), &xIntPart);
float yIntPart;
float yFracPart = std::modf(pos.getY(), &yIntPart);
float zIntPart;
float zFracPart = std::modf(pos.getZ(), &zIntPart);
//Of all the fractional parts, two should be zero and one should have a value.
if(xFracPart > 0.000001f)
{
vertexIndicesX[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)] = newIndex;
}
if(yFracPart > 0.000001f)
{
vertexIndicesY[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)] = newIndex;
}
if(zFracPart > 0.000001f)
{
vertexIndicesZ[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)] = newIndex;
}
}
const std::vector<SurfaceVertex>& IndexedSurfacePatch::getVertices(void) const const std::vector<SurfaceVertex>& IndexedSurfacePatch::getVertices(void) const
{ {
return m_vecVertices; return m_vecVertices;

View File

@ -27,12 +27,12 @@ namespace PolyVox
{ {
//Generate the surface //Generate the surface
RegionGeometry regionGeometry; RegionGeometry regionGeometry;
regionGeometry.m_patchSingleMaterial = new IndexedSurfacePatch(false); regionGeometry.m_patchSingleMaterial = new IndexedSurfacePatch();
regionGeometry.m_v3dRegionPosition = iterChangedRegions->getLowerCorner(); regionGeometry.m_v3dRegionPosition = iterChangedRegions->getLowerCorner();
//generateDecimatedMeshDataForRegion(volume.getVolumeData(), 0, *iterChangedRegions, regionGeometry.m_patchSingleMaterial); generateDecimatedMeshDataForRegion(volume.getVolumeData(), 1, *iterChangedRegions, regionGeometry.m_patchSingleMaterial);
generateReferenceMeshDataForRegion(volume.getVolumeData(), *iterChangedRegions, regionGeometry.m_patchSingleMaterial); //generateReferenceMeshDataForRegion(volume.getVolumeData(), *iterChangedRegions, regionGeometry.m_patchSingleMaterial);
//for(int ct = 0; ct < 2; ct++) //for(int ct = 0; ct < 2; ct++)
Vector3DInt32 temp = regionGeometry.m_v3dRegionPosition; Vector3DInt32 temp = regionGeometry.m_v3dRegionPosition;
@ -578,6 +578,14 @@ namespace PolyVox
void generateReferenceMeshDataForRegion(BlockVolume<uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch) void generateReferenceMeshDataForRegion(BlockVolume<uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
{ {
static std::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
static std::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
static std::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
memset(vertexIndicesX,0xFF,sizeof(vertexIndicesX)); //0xFF is -1 as two's complement - this may not be portable...
memset(vertexIndicesY,0xFF,sizeof(vertexIndicesY));
memset(vertexIndicesZ,0xFF,sizeof(vertexIndicesZ));
//When generating the mesh for a region we actually look one voxel outside it in the //When generating the mesh for a region we actually look one voxel outside it in the
// back, bottom, right direction. Protect against access violations by cropping region here // back, bottom, right direction. Protect against access violations by cropping region here
Region regVolume = volumeData->getEnclosingRegion(); Region regVolume = volumeData->getEnclosingRegion();
@ -778,26 +786,113 @@ namespace PolyVox
const uint8_t material2 = vertMaterials[triTable[iCubeIndex][i+2]]; const uint8_t material2 = vertMaterials[triTable[iCubeIndex][i+2]];
//If all the materials are the same, we just need one triangle for that material with all the alphas set high. //If all the materials are the same, we just need one triangle for that material with all the alphas set high.
SurfaceVertex surfaceVertex0Alpha1(vertex0, normal0, material0 + 0.1f); SurfaceVertex v0(vertex0, normal0, material0 + 0.1f);
SurfaceVertex surfaceVertex1Alpha1(vertex1, normal1, material1 + 0.1f); SurfaceVertex v1(vertex1, normal1, material1 + 0.1f);
SurfaceVertex surfaceVertex2Alpha1(vertex2, normal2, material2 + 0.1f); SurfaceVertex v2(vertex2, normal2, material2 + 0.1f);
singleMaterialPatch->addTriangle(surfaceVertex0Alpha1, surfaceVertex1Alpha1, surfaceVertex2Alpha1);
//singleMaterialPatch->addTriangle(surfaceVertex0Alpha1, surfaceVertex1Alpha1, surfaceVertex2Alpha1);
int32_t index = getIndexFor(v0.getPosition(), vertexIndicesX, vertexIndicesY, vertexIndicesZ);
if(index == -1)
{
singleMaterialPatch->m_vecVertices.push_back(v0);
singleMaterialPatch->m_vecTriangleIndices.push_back(singleMaterialPatch->m_vecVertices.size()-1);
setIndexFor(v0.getPosition(), singleMaterialPatch->m_vecVertices.size()-1, vertexIndicesX, vertexIndicesY, vertexIndicesZ);
}
else
{
singleMaterialPatch->m_vecTriangleIndices.push_back(index);
}
index = getIndexFor(v1.getPosition(), vertexIndicesX, vertexIndicesY, vertexIndicesZ);
if(index == -1)
{
singleMaterialPatch->m_vecVertices.push_back(v1);
singleMaterialPatch->m_vecTriangleIndices.push_back(singleMaterialPatch->m_vecVertices.size()-1);
setIndexFor(v1.getPosition(), singleMaterialPatch->m_vecVertices.size()-1, vertexIndicesX, vertexIndicesY, vertexIndicesZ);
}
else
{
singleMaterialPatch->m_vecTriangleIndices.push_back(index);
}
index = getIndexFor(v2.getPosition(), vertexIndicesX, vertexIndicesY, vertexIndicesZ);
if(index == -1)
{
singleMaterialPatch->m_vecVertices.push_back(v2);
singleMaterialPatch->m_vecTriangleIndices.push_back(singleMaterialPatch->m_vecVertices.size()-1);
setIndexFor(v2.getPosition(), singleMaterialPatch->m_vecVertices.size()-1, vertexIndicesX, vertexIndicesY, vertexIndicesZ);
}
else
{
singleMaterialPatch->m_vecTriangleIndices.push_back(index);
}
}//For each triangle }//For each triangle
}//For each cell }//For each cell
//FIXME - can it happen that we have no vertices or triangles? Should exit early?
//for(std::map<uint8_t, IndexedSurfacePatch*>::iterator iterPatch = surfacePatchMapResult.begin(); iterPatch != surfacePatchMapResult.end(); ++iterPatch)
/*{
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = singleMaterialPatch->getVertices().begin();
while(iterSurfaceVertex != singleMaterialPatch->getVertices().end())
{
Vector3DFloat tempNormal = computeNormal(volumeData, static_cast<Vector3DFloat>(iterSurfaceVertex->getPosition() + offset), CENTRAL_DIFFERENCE);
const_cast<SurfaceVertex&>(*iterSurfaceVertex).setNormal(tempNormal);
++iterSurfaceVertex;
} }
}*/
std::int32_t getIndexFor(const Vector3DFloat& pos, std::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1])
{
assert(pos.getX() >= 0.0f);
assert(pos.getY() >= 0.0f);
assert(pos.getZ() >= 0.0f);
assert(pos.getX() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getY() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getZ() <= POLYVOX_REGION_SIDE_LENGTH);
float xIntPart;
float xFracPart = std::modf(pos.getX(), &xIntPart);
float yIntPart;
float yFracPart = std::modf(pos.getY(), &yIntPart);
float zIntPart;
float zFracPart = std::modf(pos.getZ(), &zIntPart);
//Of all the fractional parts, two should be zero and one should have a value.
if(xFracPart > 0.000001f)
{
return vertexIndicesX[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)];
}
if(yFracPart > 0.000001f)
{
return vertexIndicesY[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)];
}
if(zFracPart > 0.000001f)
{
return vertexIndicesZ[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)];
}
while(true);
}
void setIndexFor(const Vector3DFloat& pos, std::int32_t newIndex, std::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1])
{
assert(pos.getX() >= 0.0f);
assert(pos.getY() >= 0.0f);
assert(pos.getZ() >= 0.0f);
assert(pos.getX() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getY() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getZ() <= POLYVOX_REGION_SIDE_LENGTH);
assert(newIndex < 10000);
float xIntPart;
float xFracPart = std::modf(pos.getX(), &xIntPart);
float yIntPart;
float yFracPart = std::modf(pos.getY(), &yIntPart);
float zIntPart;
float zFracPart = std::modf(pos.getZ(), &zIntPart);
//Of all the fractional parts, two should be zero and one should have a value.
if(xFracPart > 0.000001f)
{
vertexIndicesX[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)] = newIndex;
}
if(yFracPart > 0.000001f)
{
vertexIndicesY[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)] = newIndex;
}
if(zFracPart > 0.000001f)
{
vertexIndicesZ[static_cast<uint16_t>(xIntPart)][static_cast<uint16_t>(yIntPart)][static_cast<uint16_t>(zIntPart)] = newIndex;
}
} }
} }

View File

@ -150,7 +150,7 @@ void main ( int argc, char** argv ) // Create Main Function For Bringing It Al
{ {
for(uint16_t uRegionX = 0; uRegionX < g_uVolumeSideLengthInRegions; ++uRegionX) for(uint16_t uRegionX = 0; uRegionX < g_uVolumeSideLengthInRegions; ++uRegionX)
{ {
g_ispRegionSurfaces[uRegionX][uRegionY][uRegionZ] = new IndexedSurfacePatch(false); g_ispRegionSurfaces[uRegionX][uRegionY][uRegionZ] = new IndexedSurfacePatch();
IndexedSurfacePatch* ispCurrent = g_ispRegionSurfaces[uRegionX][uRegionY][uRegionZ]; IndexedSurfacePatch* ispCurrent = g_ispRegionSurfaces[uRegionX][uRegionY][uRegionZ];
Vector3DInt32 regLowerCorner(uRegionX * g_uRegionSideLength, uRegionY * g_uRegionSideLength, uRegionZ * g_uRegionSideLength); Vector3DInt32 regLowerCorner(uRegionX * g_uRegionSideLength, uRegionY * g_uRegionSideLength, uRegionZ * g_uRegionSideLength);
Vector3DInt32 regUpperCorner((uRegionX + 1) * g_uRegionSideLength, (uRegionY + 1) * g_uRegionSideLength, (uRegionZ + 1) * g_uRegionSideLength); Vector3DInt32 regUpperCorner((uRegionX + 1) * g_uRegionSideLength, (uRegionY + 1) * g_uRegionSideLength, (uRegionZ + 1) * g_uRegionSideLength);