Initial work on progressive mesh generation. Currently based on Stan Melax's PolyChop.

This commit is contained in:
David Williams
2009-10-20 22:02:58 +00:00
parent 5eb538e925
commit c695a7bc86
16 changed files with 1006 additions and 26 deletions

View File

@ -6,15 +6,19 @@
using namespace PolyVox;
using namespace std;
void renderRegionImmediateMode(PolyVox::IndexedSurfacePatch& isp)
void renderRegionImmediateMode(PolyVox::IndexedSurfacePatch& isp, unsigned int uLodLevel)
{
const vector<SurfaceVertex>& vecVertices = isp.getVertices();
const vector<PolyVox::uint32_t>& vecIndices = isp.getIndices();
int beginIndex = isp.m_vecLodRecords[uLodLevel].beginIndex;
int endIndex = isp.m_vecLodRecords[uLodLevel].endIndex;
glBegin(GL_TRIANGLES);
for(vector<PolyVox::uint32_t>::const_iterator iterIndex = vecIndices.begin(); iterIndex != vecIndices.end(); ++iterIndex)
//for(vector<PolyVox::uint32_t>::const_iterator iterIndex = vecIndices.begin(); iterIndex != vecIndices.end(); ++iterIndex)
for(int index = beginIndex; index < endIndex; ++index)
{
const SurfaceVertex& vertex = vecVertices[*iterIndex];
const SurfaceVertex& vertex = vecVertices[vecIndices[index]];
const Vector3DFloat& v3dVertexPos = vertex.getPosition();
//const Vector3DFloat v3dRegionOffset(uRegionX * g_uRegionSideLength, uRegionY * g_uRegionSideLength, uRegionZ * g_uRegionSideLength);
const Vector3DFloat v3dFinalVertexPos = v3dVertexPos + static_cast<Vector3DFloat>(isp.m_Region.getLowerCorner());