Removed setVoxel() function from BlockVolumeIterator and added setVoxelAt() function to BlockVolume.h

Improved OpenGL example.
This commit is contained in:
David Williams
2009-03-12 21:48:14 +00:00
parent 7100e558f3
commit 0f4a4c0e2b
7 changed files with 148 additions and 114 deletions

View File

@ -28,7 +28,6 @@ namespace PolyVox
uint16 volumeDepth = 0x0001 << volumeDepthPower;
//Read data
BlockVolumeIterator<uint8> volIter(*volume);
for(uint16 z = 0; z < volumeDepth; ++z)
{
for(uint16 y = 0; y < volumeHeight; ++y)
@ -38,8 +37,7 @@ namespace PolyVox
uint8 value = 0;
stream.read(reinterpret_cast<char*>(&value), sizeof(value));
volIter.setPosition(x,y,z);
volIter.setVoxel(value);
volume->setVoxelAt(x,y,z,value);
}
}
}
@ -98,7 +96,6 @@ namespace PolyVox
uint16 volumeDepth = 0x0001 << volumeDepthPower;
//Read data
BlockVolumeIterator<uint8> volIter(*volume);
bool firstTime = true;
uint32 runLength = 0;
uint8 value = 0;
@ -110,10 +107,9 @@ namespace PolyVox
{
for(uint16 x = 0; x < volumeWidth; ++x)
{
volIter.setPosition(x,y,z);
if(runLength != 0)
{
volIter.setVoxel(value);
volume->setVoxelAt(x,y,z,value);
runLength--;
}
else
@ -121,7 +117,7 @@ namespace PolyVox
stream.read(reinterpret_cast<char*>(&value), sizeof(value));
stream.read(reinterpret_cast<char*>(&runLength), sizeof(runLength));
volIter.setVoxel(value);
volume->setVoxelAt(x,y,z,value);
runLength--;
}
}

View File

@ -117,9 +117,11 @@ namespace PolyVox
{
++m_iCurrentTime;
//FIXME - rather than creating a iterator each time we should have one stored
BlockVolumeIterator<uint8> iterVol(*volumeData);
iterVol.setPosition(x,y,z);
iterVol.setVoxel(value);
//BlockVolumeIterator<uint8> iterVol(*volumeData);
/*iterVol.setPosition(x,y,z);
iterVol.setVoxel(value);*/
volumeData->setVoxelAt(x,y,z,value);
//If we are not on a boundary, just mark one region.
if((x % POLYVOX_REGION_SIDE_LENGTH != 0) &&
@ -164,9 +166,10 @@ namespace PolyVox
assert(m_bIsLocked);
//FIXME - rather than creating a iterator each time we should have one stored
BlockVolumeIterator<uint8> iterVol(*volumeData);
/*BlockVolumeIterator<uint8> iterVol(*volumeData);
iterVol.setPosition(x,y,z);
iterVol.setVoxel(value);
iterVol.setVoxel(value);*/
volumeData->setVoxelAt(x,y,z,value);
}
void VolumeChangeTracker::lockRegion(const Region& regToLock)