Refactoring VolumeChangeTracker
This commit is contained in:
parent
44af6f12e8
commit
b7e9216355
@ -23,12 +23,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#define __PolyVox_Region_H__
|
||||
|
||||
#pragma region Headers
|
||||
#include "TypeDef.h"
|
||||
#include "Vector.h"
|
||||
#pragma endregion
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
class Region
|
||||
class POLYVOX_API Region
|
||||
{
|
||||
public:
|
||||
Region();
|
||||
|
@ -41,7 +41,9 @@ namespace PolyVox
|
||||
~VolumeChangeTracker();
|
||||
|
||||
//Getters
|
||||
boost::uint8_t getMaterialIndexAt(boost::uint16_t uX, boost::uint16_t uY, boost::uint16_t uZ);
|
||||
Region getEnclosingRegion(void);
|
||||
boost::uint8_t getVoxelAt(const Vector3DUint16& pos);
|
||||
boost::uint8_t getVoxelAt(boost::uint16_t uX, boost::uint16_t uY, boost::uint16_t uZ);
|
||||
const std::string& getTypeName(void) const;
|
||||
boost::uint16_t getSideLength(void);
|
||||
|
||||
@ -51,19 +53,11 @@ namespace PolyVox
|
||||
//Setters
|
||||
void setVolumeData(BlockVolume<boost::uint8_t>* volumeDataToSet);
|
||||
void setNormalGenerationMethod(NormalGenerationMethod method);
|
||||
//void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo * visibleBounds, bool onlyShadowCasters);
|
||||
|
||||
std::list<RegionGeometry> getChangedRegionGeometry(void);
|
||||
|
||||
void setAllUpToDateFlagsTo(bool newUpToDateValue);
|
||||
|
||||
//void generateLevelVolume(void);
|
||||
|
||||
|
||||
|
||||
|
||||
//bool containsPoint(Vector3DFloat pos, float boundary);
|
||||
//bool containsPoint(Vector3DInt32 pos, boost::uint16_t boundary);
|
||||
|
||||
|
||||
LinearVolume<bool>* volSurfaceUpToDate;
|
||||
@ -77,19 +71,9 @@ namespace PolyVox
|
||||
void setVoxelAt(boost::uint16_t x, boost::uint16_t y, boost::uint16_t z, boost::uint8_t value);
|
||||
|
||||
|
||||
static boost::uint16_t fileNo;
|
||||
|
||||
bool useNormalSmoothing;
|
||||
boost::uint16_t normalSmoothingFilterSize;
|
||||
|
||||
NormalGenerationMethod m_normalGenerationMethod;
|
||||
|
||||
private:
|
||||
BlockVolume<boost::uint8_t>* volumeData;
|
||||
|
||||
bool m_bHaveGeneratedMeshes;
|
||||
|
||||
//std::string m_aMaterialNames[256];
|
||||
BlockVolume<boost::uint8_t>* volumeData;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -42,12 +42,7 @@ namespace PolyVox
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
VolumeChangeTracker::VolumeChangeTracker()
|
||||
:volumeData(0)
|
||||
,useNormalSmoothing(false)
|
||||
,normalSmoothingFilterSize(1)
|
||||
,m_normalGenerationMethod(SOBEL)
|
||||
,m_bHaveGeneratedMeshes(false)
|
||||
{
|
||||
//sceneNodes.clear();`
|
||||
}
|
||||
|
||||
VolumeChangeTracker::~VolumeChangeTracker()
|
||||
@ -147,23 +142,25 @@ namespace PolyVox
|
||||
return volumeData->getSideLength();
|
||||
}
|
||||
|
||||
uint8_t VolumeChangeTracker::getMaterialIndexAt(uint16_t uX, uint16_t uY, uint16_t uZ)
|
||||
Region VolumeChangeTracker::getEnclosingRegion(void)
|
||||
{
|
||||
if(volumeData->containsPoint(Vector3DInt32(uX,uY,uZ),0))
|
||||
{
|
||||
VolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
volIter.setPosition(uX,uY,uZ);
|
||||
return volIter.getVoxel();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return volumeData->getEnclosingRegion();
|
||||
}
|
||||
|
||||
void VolumeChangeTracker::setNormalGenerationMethod(NormalGenerationMethod method)
|
||||
uint8_t VolumeChangeTracker::getVoxelAt(const Vector3DUint16& pos)
|
||||
{
|
||||
m_normalGenerationMethod = method;
|
||||
return getVoxelAt(pos.x(), pos.y(), pos.z());
|
||||
}
|
||||
|
||||
uint8_t VolumeChangeTracker::getVoxelAt(uint16_t uX, uint16_t uY, uint16_t uZ)
|
||||
{
|
||||
assert(ux < volumeData->getSideLength());
|
||||
assert(uy < volumeData->getSideLength());
|
||||
assert(uz < volumeData->getSideLength());
|
||||
|
||||
VolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
volIter.setPosition(uX,uY,uZ);
|
||||
return volIter.getVoxel();
|
||||
}
|
||||
|
||||
const BlockVolume<boost::uint8_t>* VolumeChangeTracker::getVolumeData(void) const
|
||||
|
Loading…
x
Reference in New Issue
Block a user