Refactoring work... working on meshes

This commit is contained in:
David Williams 2007-09-01 11:40:54 +00:00
parent 94df0acd48
commit abe66c3d81
3 changed files with 14 additions and 9 deletions

View File

@ -32,7 +32,9 @@ namespace Ogre
void getVertexAndIndexData(std::vector<SurfaceVertex>& vertexData, std::vector<uint>& indexData);
void computeNormalsFromVolume(uint regionX, uint regionY, uint regionZ, VolumeIterator volIter);
void computeNormalsFromVolume(VolumeIterator volIter);
UIntVector3 m_v3dOffset;
private:
std::set<SurfaceVertex> m_setVertices;
@ -45,6 +47,8 @@ namespace Ogre
uint m_uVerticesAdded;
long int* vertexIndices;
//UIntVector3 m_v3dOffset;
};
}

View File

@ -1005,7 +1005,8 @@ namespace Ogre
for(std::map<uchar, SurfacePatch>::iterator iterPatch = result.begin(); iterPatch != result.end(); ++iterPatch)
{
iterPatch->second.computeNormalsFromVolume(regionX,regionY,regionZ,volIter);
iterPatch->second.m_v3dOffset = offset;
iterPatch->second.computeNormalsFromVolume(volIter);
iterPatch->second.endDefinition();
}

View File

@ -56,19 +56,19 @@ namespace Ogre
triangle.v2->listTrianglesUsingThisVertex.push_back(m_listTriangles.end());
}
void SurfacePatch::computeNormalsFromVolume(uint regionX, uint regionY, uint regionZ, VolumeIterator volIter)
void SurfacePatch::computeNormalsFromVolume(VolumeIterator volIter)
{
//LogManager::getSingleton().logMessage("In SurfacePatch::computeNormalsFromVolume");
for(std::set<SurfaceVertex>::iterator vertexIter = m_setVertices.begin(); vertexIter != m_setVertices.end(); ++vertexIter)
{
//LogManager::getSingleton().logMessage("In Loop");
const float posX = vertexIter->position.x/2.0f + static_cast<float>(regionX * OGRE_REGION_SIDE_LENGTH);
const float posY = vertexIter->position.y/2.0f + static_cast<float>(regionY * OGRE_REGION_SIDE_LENGTH);
const float posZ = vertexIter->position.z/2.0f + static_cast<float>(regionZ * OGRE_REGION_SIDE_LENGTH);
const float posX = (vertexIter->position.x + m_v3dOffset.x) / 2.0f;
const float posY = (vertexIter->position.y + m_v3dOffset.y) / 2.0f;
const float posZ = (vertexIter->position.z + m_v3dOffset.z) / 2.0f;
const uint floorX = static_cast<uint>(vertexIter->position.x/2.0f) + regionX * OGRE_REGION_SIDE_LENGTH;
const uint floorY = static_cast<uint>(vertexIter->position.y/2.0f) + regionY * OGRE_REGION_SIDE_LENGTH;
const uint floorZ = static_cast<uint>(vertexIter->position.z/2.0f) + regionZ * OGRE_REGION_SIDE_LENGTH;
const uint floorX = static_cast<uint>(posX);
const uint floorY = static_cast<uint>(posY);
const uint floorZ = static_cast<uint>(posZ);
NormalGenerationMethod normalGenerationMethod = CENTRAL_DIFFERENCE;