From 9a58b83b6dec88899a8ab0f7f250c6e1c4b2ca02 Mon Sep 17 00:00:00 2001 From: David Williams Date: Wed, 25 Jun 2008 20:16:58 +0000 Subject: [PATCH] Tidying up... --- PolyVoxCore/CMakeLists.txt | 2 + PolyVoxCore/include/BlockVolumeIterator.h | 2 +- PolyVoxCore/include/BlockVolumeIterator.inl | 38 ++++----- PolyVoxCore/include/GradientEstimators.inl | 2 +- PolyVoxCore/include/SurfaceAdjusters.h | 1 - PolyVoxCore/include/VoxelFilters.h | 36 +++++++++ PolyVoxCore/source/SurfaceAdjusters.cpp | 46 +---------- .../source/SurfaceExtractorsDecimated.cpp | 78 +++++++++---------- PolyVoxCore/source/VoxelFilters.cpp | 51 ++++++++++++ TODO.txt | 8 +- 10 files changed, 155 insertions(+), 109 deletions(-) create mode 100644 PolyVoxCore/include/VoxelFilters.h create mode 100644 PolyVoxCore/source/VoxelFilters.cpp diff --git a/PolyVoxCore/CMakeLists.txt b/PolyVoxCore/CMakeLists.txt index 5eef3f17..e61749e9 100644 --- a/PolyVoxCore/CMakeLists.txt +++ b/PolyVoxCore/CMakeLists.txt @@ -20,6 +20,7 @@ SET(SRC_FILES source/SurfaceVertex.cpp source/Utility.cpp source/VolumeChangeTracker.cpp + source/VoxelFilters.cpp ) #Projects headers files @@ -50,6 +51,7 @@ SET(INC_FILES include/Vector.h include/Vector.inl include/VolumeChangeTracker.h + include/VoxelFilters.h ) FIND_PACKAGE(Boost REQUIRED) diff --git a/PolyVoxCore/include/BlockVolumeIterator.h b/PolyVoxCore/include/BlockVolumeIterator.h index 61a907c7..5bbbb494 100644 --- a/PolyVoxCore/include/BlockVolumeIterator.h +++ b/PolyVoxCore/include/BlockVolumeIterator.h @@ -43,10 +43,10 @@ namespace PolyVox bool operator<=(const BlockVolumeIterator& rhs); bool operator>=(const BlockVolumeIterator& rhs); - VoxelType getMaxedVoxel(boost::uint8_t uLevel) const; boost::uint16_t getPosX(void) const; boost::uint16_t getPosY(void) const; boost::uint16_t getPosZ(void) const; + VoxelType getSubSampledVoxel(boost::uint8_t uLevel) const; const BlockVolume& getVolume(void) const; VoxelType getVoxel(void) const; diff --git a/PolyVoxCore/include/BlockVolumeIterator.inl b/PolyVoxCore/include/BlockVolumeIterator.inl index 6bf53227..37789a7f 100644 --- a/PolyVoxCore/include/BlockVolumeIterator.inl +++ b/PolyVoxCore/include/BlockVolumeIterator.inl @@ -105,7 +105,25 @@ namespace PolyVox #pragma region Getters template - VoxelType BlockVolumeIterator::getMaxedVoxel(boost::uint8_t uLevel) const + boost::uint16_t BlockVolumeIterator::getPosX(void) const + { + return mXPosInVolume; + } + + template + boost::uint16_t BlockVolumeIterator::getPosY(void) const + { + return mYPosInVolume; + } + + template + boost::uint16_t BlockVolumeIterator::getPosZ(void) const + { + return mZPosInVolume; + } + + template + VoxelType BlockVolumeIterator::getSubSampledVoxel(boost::uint8_t uLevel) const { if(uLevel == 0) { @@ -142,24 +160,6 @@ namespace PolyVox } } - template - boost::uint16_t BlockVolumeIterator::getPosX(void) const - { - return mXPosInVolume; - } - - template - boost::uint16_t BlockVolumeIterator::getPosY(void) const - { - return mYPosInVolume; - } - - template - boost::uint16_t BlockVolumeIterator::getPosZ(void) const - { - return mZPosInVolume; - } - template const BlockVolume& BlockVolumeIterator::getVolume(void) const { diff --git a/PolyVoxCore/include/GradientEstimators.inl b/PolyVoxCore/include/GradientEstimators.inl index 3c93f1f6..dbe529c9 100644 --- a/PolyVoxCore/include/GradientEstimators.inl +++ b/PolyVoxCore/include/GradientEstimators.inl @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #pragma endregion -#include "SurfaceAdjusters.h" +#include "VoxelFilters.h" namespace PolyVox { diff --git a/PolyVoxCore/include/SurfaceAdjusters.h b/PolyVoxCore/include/SurfaceAdjusters.h index b978a23b..dc96a564 100644 --- a/PolyVoxCore/include/SurfaceAdjusters.h +++ b/PolyVoxCore/include/SurfaceAdjusters.h @@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. namespace PolyVox { POLYVOX_API void smoothRegionGeometry(BlockVolume* volumeData, RegionGeometry& regGeom); - float computeSmoothedVoxel(BlockVolumeIterator& volIter); } #endif \ No newline at end of file diff --git a/PolyVoxCore/include/VoxelFilters.h b/PolyVoxCore/include/VoxelFilters.h new file mode 100644 index 00000000..2c3d829c --- /dev/null +++ b/PolyVoxCore/include/VoxelFilters.h @@ -0,0 +1,36 @@ +#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 + +#ifndef __PolyVox_VoxelFilters_H__ +#define __PolyVox_VoxelFilters_H__ + +#pragma region Headers +#include "Constants.h" +#include "PolyVoxForwardDeclarations.h" +#include "TypeDef.h" +#pragma endregion + +namespace PolyVox +{ + float computeSmoothedVoxel(BlockVolumeIterator& volIter); +} + +#endif \ No newline at end of file diff --git a/PolyVoxCore/source/SurfaceAdjusters.cpp b/PolyVoxCore/source/SurfaceAdjusters.cpp index dacc3ebe..a49ed426 100644 --- a/PolyVoxCore/source/SurfaceAdjusters.cpp +++ b/PolyVoxCore/source/SurfaceAdjusters.cpp @@ -5,6 +5,7 @@ #include "IndexedSurfacePatch.h" #include "RegionGeometry.h" #include "Utility.h" +#include "VoxelFilters.h" #include @@ -73,49 +74,4 @@ namespace PolyVox ++iterSurfaceVertex; } //while(iterSurfaceVertex != vecVertices.end()) } - - float computeSmoothedVoxel(BlockVolumeIterator& volIter) - { - assert(volIter.getPosX() >= 1); - assert(volIter.getPosY() >= 1); - assert(volIter.getPosZ() >= 1); - assert(volIter.getPosX() < volIter.getVolume().getSideLength() - 2); - assert(volIter.getPosY() < volIter.getVolume().getSideLength() - 2); - assert(volIter.getPosZ() < volIter.getVolume().getSideLength() - 2); - - float sum = 0.0; - - if(volIter.peekVoxel1nx1ny1nz() != 0) sum += 1.0f; - if(volIter.peekVoxel1nx1ny0pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1nx1ny1pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1nx0py1nz() != 0) sum += 1.0f; - if(volIter.peekVoxel1nx0py0pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1nx0py1pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1nx1py1nz() != 0) sum += 1.0f; - if(volIter.peekVoxel1nx1py0pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1nx1py1pz() != 0) sum += 1.0f; - - if(volIter.peekVoxel0px1ny1nz() != 0) sum += 1.0f; - if(volIter.peekVoxel0px1ny0pz() != 0) sum += 1.0f; - if(volIter.peekVoxel0px1ny1pz() != 0) sum += 1.0f; - if(volIter.peekVoxel0px0py1nz() != 0) sum += 1.0f; - if(volIter.getVoxel() != 0) sum += 1.0f; - if(volIter.peekVoxel0px0py1pz() != 0) sum += 1.0f; - if(volIter.peekVoxel0px1py1nz() != 0) sum += 1.0f; - if(volIter.peekVoxel0px1py0pz() != 0) sum += 1.0f; - if(volIter.peekVoxel0px1py1pz() != 0) sum += 1.0f; - - if(volIter.peekVoxel1px1ny1nz() != 0) sum += 1.0f; - if(volIter.peekVoxel1px1ny0pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1px1ny1pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1px0py1nz() != 0) sum += 1.0f; - if(volIter.peekVoxel1px0py0pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1px0py1pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1px1py1nz() != 0) sum += 1.0f; - if(volIter.peekVoxel1px1py0pz() != 0) sum += 1.0f; - if(volIter.peekVoxel1px1py1pz() != 0) sum += 1.0f; - - sum /= 27.0f; - return sum; - } } \ No newline at end of file diff --git a/PolyVoxCore/source/SurfaceExtractorsDecimated.cpp b/PolyVoxCore/source/SurfaceExtractorsDecimated.cpp index 8da004c0..9c925da4 100644 --- a/PolyVoxCore/source/SurfaceExtractorsDecimated.cpp +++ b/PolyVoxCore/source/SurfaceExtractorsDecimated.cpp @@ -129,22 +129,22 @@ namespace PolyVox if((x==regSlice.getLowerCorner().getX()) && (y==regSlice.getLowerCorner().getY())) { volIter.setPosition(x,y,regSlice.getLowerCorner().getZ()); - const uint8_t v000 = volIter.getMaxedVoxel(uLevel); + const uint8_t v000 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y,regSlice.getLowerCorner().getZ()); - const uint8_t v100 = volIter.getMaxedVoxel(uLevel); + const uint8_t v100 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x,y+uStepSize,regSlice.getLowerCorner().getZ()); - const uint8_t v010 = volIter.getMaxedVoxel(uLevel); + const uint8_t v010 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()); - const uint8_t v110 = volIter.getMaxedVoxel(uLevel); + const uint8_t v110 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x,y,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v001 = volIter.getMaxedVoxel(uLevel); + const uint8_t v001 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v101 = volIter.getMaxedVoxel(uLevel); + const uint8_t v101 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v011 = volIter.getMaxedVoxel(uLevel); + const uint8_t v011 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v111 = volIter.getMaxedVoxel(uLevel); + const uint8_t v111 = volIter.getSubSampledVoxel(uLevel); if (v000 == 0) iCubeIndex |= 1; if (v100 == 0) iCubeIndex |= 2; @@ -158,14 +158,14 @@ namespace PolyVox else if((x>regSlice.getLowerCorner().getX()) && y==regSlice.getLowerCorner().getY()) { volIter.setPosition(x+uStepSize,y,regSlice.getLowerCorner().getZ()); - const uint8_t v100 = volIter.getMaxedVoxel(uLevel); + const uint8_t v100 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()); - const uint8_t v110 = volIter.getMaxedVoxel(uLevel); + const uint8_t v110 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v101 = volIter.getMaxedVoxel(uLevel); + const uint8_t v101 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v111 = volIter.getMaxedVoxel(uLevel); + const uint8_t v111 = volIter.getSubSampledVoxel(uLevel); //x uint8_t iPreviousCubeIndexX = bitmask[getDecimatedIndex(x- offset.getX()-uStepSize,y- offset.getY())]; @@ -193,14 +193,14 @@ namespace PolyVox else if((x==regSlice.getLowerCorner().getX()) && (y>regSlice.getLowerCorner().getY())) { volIter.setPosition(x,y+uStepSize,regSlice.getLowerCorner().getZ()); - const uint8_t v010 = volIter.getMaxedVoxel(uLevel); + const uint8_t v010 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()); - const uint8_t v110 = volIter.getMaxedVoxel(uLevel); + const uint8_t v110 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v011 = volIter.getMaxedVoxel(uLevel); + const uint8_t v011 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v111 = volIter.getMaxedVoxel(uLevel); + const uint8_t v111 = volIter.getSubSampledVoxel(uLevel); //y uint8_t iPreviousCubeIndexY = bitmask[getDecimatedIndex(x- offset.getX(),y- offset.getY()-uStepSize)]; @@ -228,10 +228,10 @@ namespace PolyVox else { volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()); - const uint8_t v110 = volIter.getMaxedVoxel(uLevel); + const uint8_t v110 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v111 = volIter.getMaxedVoxel(uLevel); + const uint8_t v111 = volIter.getSubSampledVoxel(uLevel); //y uint8_t iPreviousCubeIndexY = bitmask[getDecimatedIndex(x- offset.getX(),y- offset.getY()-uStepSize)]; @@ -298,13 +298,13 @@ namespace PolyVox if((x==regSlice.getLowerCorner().getX()) && (y==regSlice.getLowerCorner().getY())) { volIter.setPosition(x,y,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v001 = volIter.getMaxedVoxel(uLevel); + const uint8_t v001 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v101 = volIter.getMaxedVoxel(uLevel); + const uint8_t v101 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v011 = volIter.getMaxedVoxel(uLevel); + const uint8_t v011 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v111 = volIter.getMaxedVoxel(uLevel); + const uint8_t v111 = volIter.getSubSampledVoxel(uLevel); //z uint8_t iPreviousCubeIndexZ = previousBitmask[getDecimatedIndex(x- offset.getX(),y- offset.getY())]; @@ -318,9 +318,9 @@ namespace PolyVox else if((x>regSlice.getLowerCorner().getX()) && y==regSlice.getLowerCorner().getY()) { volIter.setPosition(x+uStepSize,y,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v101 = volIter.getMaxedVoxel(uLevel); + const uint8_t v101 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v111 = volIter.getMaxedVoxel(uLevel); + const uint8_t v111 = volIter.getSubSampledVoxel(uLevel); //z uint8_t iPreviousCubeIndexZ = previousBitmask[getDecimatedIndex(x- offset.getX(),y- offset.getY())]; @@ -342,9 +342,9 @@ namespace PolyVox else if((x==regSlice.getLowerCorner().getX()) && (y>regSlice.getLowerCorner().getY())) { volIter.setPosition(x,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v011 = volIter.getMaxedVoxel(uLevel); + const uint8_t v011 = volIter.getSubSampledVoxel(uLevel); volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v111 = volIter.getMaxedVoxel(uLevel); + const uint8_t v111 = volIter.getSubSampledVoxel(uLevel); //z uint8_t iPreviousCubeIndexZ = previousBitmask[getDecimatedIndex(x- offset.getX(),y- offset.getY())]; @@ -366,7 +366,7 @@ namespace PolyVox else { volIter.setPosition(x+uStepSize,y+uStepSize,regSlice.getLowerCorner().getZ()+uStepSize); - const uint8_t v111 = volIter.getMaxedVoxel(uLevel); + const uint8_t v111 = volIter.getSubSampledVoxel(uLevel); //z uint8_t iPreviousCubeIndexZ = previousBitmask[getDecimatedIndex(x- offset.getX(),y- offset.getY())]; @@ -418,7 +418,7 @@ namespace PolyVox const uint16_t z = regSlice.getLowerCorner().getZ(); volIter.setPosition(x,y,z); - const uint8_t v000 = volIter.getMaxedVoxel(uLevel); + const uint8_t v000 = volIter.getSubSampledVoxel(uLevel); //Determine the index into the edge table which tells us which vertices are inside of the surface uint8_t iCubeIndex = bitmask[getDecimatedIndex(x - offset.getX(),y - offset.getY())]; @@ -435,7 +435,7 @@ namespace PolyVox if(x != regSlice.getUpperCorner().getX()) { volIter.setPosition(x + uStepSize,y,z); - const uint8_t v100 = volIter.getMaxedVoxel(uLevel); + const uint8_t v100 = volIter.getSubSampledVoxel(uLevel); const Vector3DFloat v3dPosition(x - offset.getX() + 0.5f * uStepSize, y - offset.getY(), z - offset.getZ()); const Vector3DFloat v3dNormal(v000 > v100 ? 1.0f : -1.0f,0.0,0.0); const uint8_t uMaterial = v000 | v100; //Because one of these is 0, the or operation takes the max. @@ -449,7 +449,7 @@ namespace PolyVox if(y != regSlice.getUpperCorner().getY()) { volIter.setPosition(x,y + uStepSize,z); - const uint8_t v010 = volIter.getMaxedVoxel(uLevel); + const uint8_t v010 = volIter.getSubSampledVoxel(uLevel); const Vector3DFloat v3dPosition(x - offset.getX(), y - offset.getY() + 0.5f * uStepSize, z - offset.getZ()); const Vector3DFloat v3dNormal(0.0,v000 > v010 ? 1.0f : -1.0f,0.0); const uint8_t uMaterial = v000 | v010; //Because one of these is 0, the or operation takes the max. @@ -463,7 +463,7 @@ namespace PolyVox //if(z != regSlice.getUpperCorner.getZ()) { volIter.setPosition(x,y,z + uStepSize); - const uint8_t v001 = volIter.getMaxedVoxel(uLevel); + const uint8_t v001 = volIter.getSubSampledVoxel(uLevel); const Vector3DFloat v3dPosition(x - offset.getX(), y - offset.getY(), z - offset.getZ() + 0.5f * uStepSize); const Vector3DFloat v3dNormal(0.0,0.0,v000 > v001 ? 1.0f : -1.0f); const uint8_t uMaterial = v000 | v001; //Because one of these is 0, the or operation takes the max. @@ -606,21 +606,21 @@ namespace PolyVox //while(volIter.moveForwardInRegionXYZ()) //{ volIter.setPosition(x,y,z); - const uint8_t v000 = volIter.getMaxedVoxel(1); + const uint8_t v000 = volIter.getSubSampledVoxel(1); volIter.setPosition(x+2,y,z); - const uint8_t v100 = volIter.getMaxedVoxel(1); + const uint8_t v100 = volIter.getSubSampledVoxel(1); volIter.setPosition(x,y+2,z); - const uint8_t v010 = volIter.getMaxedVoxel(1); + const uint8_t v010 = volIter.getSubSampledVoxel(1); volIter.setPosition(x+2,y+2,z); - const uint8_t v110 = volIter.getMaxedVoxel(1); + const uint8_t v110 = volIter.getSubSampledVoxel(1); volIter.setPosition(x,y,z+2); - const uint8_t v001 = volIter.getMaxedVoxel(1); + const uint8_t v001 = volIter.getSubSampledVoxel(1); volIter.setPosition(x+2,y,z+2); - const uint8_t v101 = volIter.getMaxedVoxel(1); + const uint8_t v101 = volIter.getSubSampledVoxel(1); volIter.setPosition(x,y+2,z+2); - const uint8_t v011 = volIter.getMaxedVoxel(1); + const uint8_t v011 = volIter.getSubSampledVoxel(1); volIter.setPosition(x+2,y+2,z+2); - const uint8_t v111 = volIter.getMaxedVoxel(1); + const uint8_t v111 = volIter.getSubSampledVoxel(1); //Determine the index into the edge table which tells us which vertices are inside of the surface uint8_t iCubeIndex = 0; diff --git a/PolyVoxCore/source/VoxelFilters.cpp b/PolyVoxCore/source/VoxelFilters.cpp new file mode 100644 index 00000000..783b05e3 --- /dev/null +++ b/PolyVoxCore/source/VoxelFilters.cpp @@ -0,0 +1,51 @@ +#include "VoxelFilters.h" + +#include "BlockVolumeIterator.h" + +namespace PolyVox +{ + float computeSmoothedVoxel(BlockVolumeIterator& volIter) + { + assert(volIter.getPosX() >= 1); + assert(volIter.getPosY() >= 1); + assert(volIter.getPosZ() >= 1); + assert(volIter.getPosX() < volIter.getVolume().getSideLength() - 2); + assert(volIter.getPosY() < volIter.getVolume().getSideLength() - 2); + assert(volIter.getPosZ() < volIter.getVolume().getSideLength() - 2); + + float sum = 0.0; + + if(volIter.peekVoxel1nx1ny1nz() != 0) sum += 1.0f; + if(volIter.peekVoxel1nx1ny0pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1nx1ny1pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1nx0py1nz() != 0) sum += 1.0f; + if(volIter.peekVoxel1nx0py0pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1nx0py1pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1nx1py1nz() != 0) sum += 1.0f; + if(volIter.peekVoxel1nx1py0pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1nx1py1pz() != 0) sum += 1.0f; + + if(volIter.peekVoxel0px1ny1nz() != 0) sum += 1.0f; + if(volIter.peekVoxel0px1ny0pz() != 0) sum += 1.0f; + if(volIter.peekVoxel0px1ny1pz() != 0) sum += 1.0f; + if(volIter.peekVoxel0px0py1nz() != 0) sum += 1.0f; + if(volIter.getVoxel() != 0) sum += 1.0f; + if(volIter.peekVoxel0px0py1pz() != 0) sum += 1.0f; + if(volIter.peekVoxel0px1py1nz() != 0) sum += 1.0f; + if(volIter.peekVoxel0px1py0pz() != 0) sum += 1.0f; + if(volIter.peekVoxel0px1py1pz() != 0) sum += 1.0f; + + if(volIter.peekVoxel1px1ny1nz() != 0) sum += 1.0f; + if(volIter.peekVoxel1px1ny0pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1px1ny1pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1px0py1nz() != 0) sum += 1.0f; + if(volIter.peekVoxel1px0py0pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1px0py1pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1px1py1nz() != 0) sum += 1.0f; + if(volIter.peekVoxel1px1py0pz() != 0) sum += 1.0f; + if(volIter.peekVoxel1px1py1pz() != 0) sum += 1.0f; + + sum /= 27.0f; + return sum; + } +} \ No newline at end of file diff --git a/TODO.txt b/TODO.txt index 417837d1..13f24005 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,4 +1,4 @@ -For Version 0.1 +For Version 1.0 =============== Implement Memory Pool Clean up normal code - make normal generation a seperate pass. @@ -16,15 +16,17 @@ Check licensing, #regions, etc. Decimated version of marching cubes should use less memory. Unit test - compare output to reference implementation Sort awkward use of 'offset' in decimated marching cubes. +Use of LinearVolume instead of arrays. Add API docs Add manual Finish OpenGL sample. -For Version 0.2 +For Version 2.0 =============== Detect detatched regions. Handle mesh generation for detatched regions. Generate ambient lighting from volume? Utility function for closing outside surfaces? Consider how seperate surface should be generated for a single region. -Consider transparent materials like glass. \ No newline at end of file +Consider transparent materials like glass. +Allow writing meshes into volumes? \ No newline at end of file