Initial LOD working.
This commit is contained in:
parent
0d3a215637
commit
8b98d69d4e
@ -16,7 +16,6 @@ SET(CMAKE_DEBUG_POSTFIX "_d")
|
||||
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||
#SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
FIND_PACKAGE(OpenGL REQUIRED)
|
||||
|
||||
IF (WIN32)
|
||||
|
@ -54,6 +54,7 @@ namespace PolyVox
|
||||
bool containsPoint(const Vector3DInt32& pos, uint16 boundary) const;
|
||||
BlockVolumeIterator<VoxelType> firstVoxel(void);
|
||||
void idle(uint32 uAmount);
|
||||
bool isRegionHomogenous(const Region& region);
|
||||
BlockVolumeIterator<VoxelType> lastVoxel(void);
|
||||
|
||||
private:
|
||||
|
@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#pragma region Headers
|
||||
#include "Block.h"
|
||||
#include "BlockVolumeIterator.h"
|
||||
#include "Region.h"
|
||||
#include "Vector.h"
|
||||
|
||||
@ -204,6 +205,28 @@ namespace PolyVox
|
||||
{
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolume<VoxelType>::isRegionHomogenous(const Region& region)
|
||||
{
|
||||
BlockVolumeIterator<VoxelType> iter(*this);
|
||||
iter.setValidRegion(region);
|
||||
iter.setPosition(static_cast<Vector3DInt16>(region.getLowerCorner()));
|
||||
|
||||
VoxelType tFirst = iter.getVoxel();
|
||||
iter.moveForwardInRegionXYZ();
|
||||
|
||||
do
|
||||
{
|
||||
VoxelType tCurrent = iter.getVoxel();
|
||||
if(tCurrent != tFirst)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}while(iter.moveForwardInRegionXYZ());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
BlockVolumeIterator<VoxelType> BlockVolume<VoxelType>::lastVoxel(void)
|
||||
{
|
||||
|
@ -56,8 +56,8 @@ namespace PolyVox
|
||||
volRegionUpToDate = new LinearVolume<bool>(PolyVox::logBase2(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Return changed regions - cropped to volume
|
||||
void VolumeChangeTracker::getChangedRegions(std::list<Region>& listToFill) const
|
||||
{
|
||||
//Clear the list
|
||||
@ -82,7 +82,10 @@ namespace PolyVox
|
||||
const uint16 lastY = firstY + POLYVOX_REGION_SIDE_LENGTH;
|
||||
const uint16 lastZ = firstZ + POLYVOX_REGION_SIDE_LENGTH;
|
||||
|
||||
listToFill.push_back(Region(Vector3DInt32(firstX, firstY, firstZ), Vector3DInt32(lastX, lastY, lastZ)));
|
||||
Region region(Vector3DInt32(firstX, firstY, firstZ), Vector3DInt32(lastX, lastY, lastZ));
|
||||
region.cropTo(volumeData->getEnclosingRegion());
|
||||
|
||||
listToFill.push_back(region);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user