Removed RegionGeometry class.
Did lots of clean up.
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
#include "PolyVoxCore/GradientEstimators.h"
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/RegionGeometry.h"
|
||||
#include "PolyVoxCore/SurfaceVertex.h"
|
||||
|
||||
#include "PolyVoxCore/PolyVoxCStdInt.h"
|
||||
@ -9,13 +8,13 @@ using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API void computeNormalsForVertices(BlockVolume<uint8>* volumeData, RegionGeometry& regGeom, NormalGenerationMethod normalGenerationMethod)
|
||||
POLYVOX_API void computeNormalsForVertices(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod)
|
||||
{
|
||||
std::vector<SurfaceVertex>& vecVertices = regGeom.m_patchSingleMaterial->m_vecVertices;
|
||||
std::vector<SurfaceVertex>& vecVertices = isp.m_vecVertices;
|
||||
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
|
||||
while(iterSurfaceVertex != vecVertices.end())
|
||||
{
|
||||
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(regGeom.m_v3dRegionPosition);
|
||||
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_v3dRegionPosition);
|
||||
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
|
||||
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
|
@ -73,6 +73,21 @@ namespace PolyVox
|
||||
return m_vecTriangleIndices;
|
||||
}
|
||||
|
||||
const uint32 IndexedSurfacePatch::getNoOfIndices(void) const
|
||||
{
|
||||
return m_vecTriangleIndices.size();
|
||||
}
|
||||
|
||||
const uint32 IndexedSurfacePatch::getNoOfVertices(void) const
|
||||
{
|
||||
return m_vecVertices.size();
|
||||
}
|
||||
|
||||
const bool IndexedSurfacePatch::isEmpty(void) const
|
||||
{
|
||||
return (getNoOfVertices() == 0) || (getNoOfIndices() == 0);
|
||||
}
|
||||
|
||||
unsigned short IndexedSurfacePatch::getNoNonUniformTrianges(void)
|
||||
{
|
||||
unsigned short result = 0;
|
||||
|
@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/MarchingCubesTables.h"
|
||||
#include "PolyVoxCore/Region.h"
|
||||
#include "PolyVoxCore/RegionGeometry.h"
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -40,7 +39,7 @@ namespace PolyVox
|
||||
return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1));
|
||||
}
|
||||
|
||||
void generateDecimatedMeshDataForRegionImpl(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractDecimatedSurfaceImpl(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
singleMaterialPatch->m_vecVertices.clear();
|
||||
singleMaterialPatch->m_vecTriangleIndices.clear();
|
||||
|
@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
namespace PolyVox
|
||||
{
|
||||
|
||||
void generateRoughMeshDataForRegionImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractFastSurfaceImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
singleMaterialPatch->m_vecVertices.clear();
|
||||
singleMaterialPatch->m_vecTriangleIndices.clear();
|
||||
|
@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void generateReferenceMeshDataForRegionImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractReferenceSurfaceImpl(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
static int32 vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
static int32 vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
|
@ -1,30 +0,0 @@
|
||||
#pragma region License
|
||||
/******************************************************************************
|
||||
This file is part of the PolyVox library
|
||||
Copyright (C) 2006 David Williams
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
******************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/RegionGeometry.h"
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
RegionGeometry::RegionGeometry()
|
||||
{
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
#include "PolyVoxCore/GradientEstimators.h"
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/RegionGeometry.h"
|
||||
#include "PolyVoxCore/Utility.h"
|
||||
#include "PolyVoxCore/VoxelFilters.h"
|
||||
|
||||
@ -13,20 +12,20 @@ using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void smoothRegionGeometry(BlockVolume<uint8>* volumeData, RegionGeometry& regGeom)
|
||||
void smoothRegionGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp)
|
||||
{
|
||||
const uint8 uSmoothingFactor = 2;
|
||||
const float fThreshold = 0.5f;
|
||||
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
std::vector<SurfaceVertex>& vecVertices = regGeom.m_patchSingleMaterial->m_vecVertices;
|
||||
std::vector<SurfaceVertex>& vecVertices = isp.m_vecVertices;
|
||||
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
|
||||
while(iterSurfaceVertex != vecVertices.end())
|
||||
{
|
||||
for(int ct = 0; ct < uSmoothingFactor; ++ct)
|
||||
{
|
||||
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(regGeom.m_v3dRegionPosition);
|
||||
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_v3dRegionPosition);
|
||||
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
|
||||
const Vector3DFloat& v3dRem = v3dPos - static_cast<Vector3DFloat>(v3dFloor);
|
||||
|
||||
@ -77,15 +76,15 @@ namespace PolyVox
|
||||
} //while(iterSurfaceVertex != vecVertices.end())
|
||||
}
|
||||
|
||||
void adjustDecimatedGeometry(BlockVolume<uint8>* volumeData, RegionGeometry& regGeom, uint8 val)
|
||||
void adjustDecimatedGeometry(BlockVolume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val)
|
||||
{
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
|
||||
std::vector<SurfaceVertex>& vecVertices = regGeom.m_patchSingleMaterial->m_vecVertices;
|
||||
std::vector<SurfaceVertex>& vecVertices = isp.m_vecVertices;
|
||||
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
|
||||
while(iterSurfaceVertex != vecVertices.end())
|
||||
{
|
||||
Vector3DFloat v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(regGeom.m_v3dRegionPosition);
|
||||
Vector3DFloat v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_v3dRegionPosition);
|
||||
Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
|
||||
|
||||
BlockVolumeIterator<uint8> volIter(*volumeData);
|
||||
@ -111,7 +110,7 @@ namespace PolyVox
|
||||
//if(iterSurfaceVertex->getNormal().getX() > 0)
|
||||
{
|
||||
iterSurfaceVertex->setPosition(iterSurfaceVertex->getPosition() - iterSurfaceVertex->getNormal() * 0.5f);
|
||||
v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(regGeom.m_v3dRegionPosition);
|
||||
v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_v3dRegionPosition);
|
||||
v3dFloor = static_cast<Vector3DInt32>(v3dPos);
|
||||
|
||||
volIter.setPosition(static_cast<Vector3DInt16>(v3dFloor));
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/MarchingCubesTables.h"
|
||||
#include "PolyVoxCore/Region.h"
|
||||
#include "PolyVoxCore/RegionGeometry.h"
|
||||
#include "PolyVoxCore/SurfaceAdjusters.h"
|
||||
#include "PolyVoxCore/BlockVolumeIterator.h"
|
||||
|
||||
@ -19,18 +18,20 @@ using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void generateReferenceMeshDataForRegion(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractSurface(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
generateReferenceMeshDataForRegion(volumeData, region, singleMaterialPatch);
|
||||
if(uLevel == 0)
|
||||
{
|
||||
extractFastSurfaceImpl(volumeData, region, singleMaterialPatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
extractDecimatedSurfaceImpl(volumeData, uLevel, region, singleMaterialPatch);
|
||||
}
|
||||
}
|
||||
|
||||
void generateRoughMeshDataForRegion(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
void extractReferenceSurface(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
generateRoughMeshDataForRegionImpl(volumeData, region, singleMaterialPatch);
|
||||
}
|
||||
|
||||
void generateDecimatedMeshDataForRegion(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch)
|
||||
{
|
||||
generateDecimatedMeshDataForRegionImpl(volumeData, uLevel, region, singleMaterialPatch);
|
||||
extractReferenceSurfaceImpl(volumeData, region, singleMaterialPatch);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "PolyVoxCore/IndexedSurfacePatch.h"
|
||||
#include "PolyVoxCore/LinearVolume.h"
|
||||
#include "PolyVoxCore/MarchingCubesTables.h"
|
||||
#include "PolyVoxCore/RegionGeometry.h"
|
||||
#include "PolyVoxCore/SurfaceExtractors.h"
|
||||
#include "PolyVoxCore/SurfaceVertex.h"
|
||||
#include "PolyVoxCore/Utility.h"
|
||||
|
Reference in New Issue
Block a user