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__
|
#define __PolyVox_Region_H__
|
||||||
|
|
||||||
#pragma region Headers
|
#pragma region Headers
|
||||||
|
#include "TypeDef.h"
|
||||||
#include "Vector.h"
|
#include "Vector.h"
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
class Region
|
class POLYVOX_API Region
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Region();
|
Region();
|
||||||
|
@ -41,7 +41,9 @@ namespace PolyVox
|
|||||||
~VolumeChangeTracker();
|
~VolumeChangeTracker();
|
||||||
|
|
||||||
//Getters
|
//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;
|
const std::string& getTypeName(void) const;
|
||||||
boost::uint16_t getSideLength(void);
|
boost::uint16_t getSideLength(void);
|
||||||
|
|
||||||
@ -51,19 +53,11 @@ namespace PolyVox
|
|||||||
//Setters
|
//Setters
|
||||||
void setVolumeData(BlockVolume<boost::uint8_t>* volumeDataToSet);
|
void setVolumeData(BlockVolume<boost::uint8_t>* volumeDataToSet);
|
||||||
void setNormalGenerationMethod(NormalGenerationMethod method);
|
void setNormalGenerationMethod(NormalGenerationMethod method);
|
||||||
//void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo * visibleBounds, bool onlyShadowCasters);
|
|
||||||
|
|
||||||
std::list<RegionGeometry> getChangedRegionGeometry(void);
|
std::list<RegionGeometry> getChangedRegionGeometry(void);
|
||||||
|
|
||||||
void setAllUpToDateFlagsTo(bool newUpToDateValue);
|
void setAllUpToDateFlagsTo(bool newUpToDateValue);
|
||||||
|
|
||||||
//void generateLevelVolume(void);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//bool containsPoint(Vector3DFloat pos, float boundary);
|
|
||||||
//bool containsPoint(Vector3DInt32 pos, boost::uint16_t boundary);
|
|
||||||
|
|
||||||
|
|
||||||
LinearVolume<bool>* volSurfaceUpToDate;
|
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);
|
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:
|
private:
|
||||||
BlockVolume<boost::uint8_t>* volumeData;
|
BlockVolume<boost::uint8_t>* volumeData;
|
||||||
|
|
||||||
bool m_bHaveGeneratedMeshes;
|
|
||||||
|
|
||||||
//std::string m_aMaterialNames[256];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +42,7 @@ namespace PolyVox
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
VolumeChangeTracker::VolumeChangeTracker()
|
VolumeChangeTracker::VolumeChangeTracker()
|
||||||
:volumeData(0)
|
:volumeData(0)
|
||||||
,useNormalSmoothing(false)
|
|
||||||
,normalSmoothingFilterSize(1)
|
|
||||||
,m_normalGenerationMethod(SOBEL)
|
|
||||||
,m_bHaveGeneratedMeshes(false)
|
|
||||||
{
|
{
|
||||||
//sceneNodes.clear();`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VolumeChangeTracker::~VolumeChangeTracker()
|
VolumeChangeTracker::~VolumeChangeTracker()
|
||||||
@ -147,24 +142,26 @@ namespace PolyVox
|
|||||||
return volumeData->getSideLength();
|
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))
|
return volumeData->getEnclosingRegion();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t VolumeChangeTracker::getVoxelAt(const Vector3DUint16& pos)
|
||||||
{
|
{
|
||||||
|
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);
|
VolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||||
volIter.setPosition(uX,uY,uZ);
|
volIter.setPosition(uX,uY,uZ);
|
||||||
return volIter.getVoxel();
|
return volIter.getVoxel();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VolumeChangeTracker::setNormalGenerationMethod(NormalGenerationMethod method)
|
|
||||||
{
|
|
||||||
m_normalGenerationMethod = method;
|
|
||||||
}
|
|
||||||
|
|
||||||
const BlockVolume<boost::uint8_t>* VolumeChangeTracker::getVolumeData(void) const
|
const BlockVolume<boost::uint8_t>* VolumeChangeTracker::getVolumeData(void) const
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user