Moved volume pointer into base sampler class.

This commit is contained in:
David Williams 2011-07-27 21:46:57 +01:00
parent f847e6ad94
commit f7c511b2c6
7 changed files with 26 additions and 8 deletions

View File

@ -145,7 +145,11 @@ namespace PolyVox
class LargeVolume : public Volume<VoxelType> class LargeVolume : public Volume<VoxelType>
{ {
public: public:
#if defined(_MSC_VER) //DIRTY HACK!!!
class Sampler : public Volume<VoxelType>::Sampler< LargeVolume<VoxelType> >
#else
class Sampler : public Volume<VoxelType>::template Sampler< LargeVolume<VoxelType> > class Sampler : public Volume<VoxelType>::template Sampler< LargeVolume<VoxelType> >
#endif
{ {
public: public:
Sampler(LargeVolume<VoxelType>* volume); Sampler(LargeVolume<VoxelType>* volume);
@ -203,7 +207,7 @@ namespace PolyVox
private: private:
//The current volume //The current volume
LargeVolume<VoxelType>* mVolume; //LargeVolume<VoxelType>* mVolume;
//The current position in the volume //The current position in the volume
int32_t mXPosInVolume; int32_t mXPosInVolume;

View File

@ -36,8 +36,10 @@ namespace PolyVox
{ {
template <typename VoxelType> template <typename VoxelType>
LargeVolume<VoxelType>::Sampler::Sampler(LargeVolume<VoxelType>* volume) LargeVolume<VoxelType>::Sampler::Sampler(LargeVolume<VoxelType>* volume)
:mVolume(volume) //:mVolume(volume)
{ {
//Dodgy doing this - need to find how to call base constructor
mVolume = volume;
} }
template <typename VoxelType> template <typename VoxelType>

View File

@ -38,7 +38,11 @@ namespace PolyVox
{ {
public: public:
#ifndef SWIG #ifndef SWIG
#if defined(_MSC_VER) //DIRTY HACK!!!
class Sampler : public Volume<VoxelType>::Sampler< RawVolume<VoxelType> >
#else
class Sampler : public Volume<VoxelType>::template Sampler< RawVolume<VoxelType> > class Sampler : public Volume<VoxelType>::template Sampler< RawVolume<VoxelType> >
#endif
{ {
public: public:
Sampler(RawVolume<VoxelType>* volume); Sampler(RawVolume<VoxelType>* volume);
@ -92,7 +96,7 @@ namespace PolyVox
private: private:
//The current volume //The current volume
RawVolume<VoxelType>* mVolume; //RawVolume<VoxelType>* mVolume;
//The current position in the volume //The current position in the volume
int32_t mXPosInVolume; int32_t mXPosInVolume;

View File

@ -31,13 +31,15 @@ namespace PolyVox
{ {
template <typename VoxelType> template <typename VoxelType>
RawVolume<VoxelType>::Sampler::Sampler(RawVolume<VoxelType>* volume) RawVolume<VoxelType>::Sampler::Sampler(RawVolume<VoxelType>* volume)
:mVolume(volume) //:mVolume(volume)
,mXPosInVolume(0) :mXPosInVolume(0)
,mYPosInVolume(0) ,mYPosInVolume(0)
,mZPosInVolume(0) ,mZPosInVolume(0)
,mCurrentVoxel(0) ,mCurrentVoxel(0)
,m_bIsCurrentPositionValid(false) ,m_bIsCurrentPositionValid(false)
{ {
//Dodgy doing this - need to find how to call base constructor
mVolume = volume;
} }
template <typename VoxelType> template <typename VoxelType>

View File

@ -60,7 +60,11 @@ namespace PolyVox
uint8_t m_uSideLengthPower; uint8_t m_uSideLengthPower;
}; };
#if defined(_MSC_VER) //DIRTY HACK!!!
class Sampler : public Volume<VoxelType>::Sampler< SimpleVolume<VoxelType> >
#else
class Sampler : public Volume<VoxelType>::template Sampler< SimpleVolume<VoxelType> > class Sampler : public Volume<VoxelType>::template Sampler< SimpleVolume<VoxelType> >
#endif
{ {
public: public:
Sampler(SimpleVolume<VoxelType>* volume); Sampler(SimpleVolume<VoxelType>* volume);
@ -118,7 +122,7 @@ namespace PolyVox
private: private:
//The current volume //The current volume
SimpleVolume<VoxelType>* mVolume; //SimpleVolume<VoxelType>* mVolume;
//The current position in the volume //The current position in the volume
int32_t mXPosInVolume; int32_t mXPosInVolume;

View File

@ -36,8 +36,10 @@ namespace PolyVox
{ {
template <typename VoxelType> template <typename VoxelType>
SimpleVolume<VoxelType>::Sampler::Sampler(SimpleVolume<VoxelType>* volume) SimpleVolume<VoxelType>::Sampler::Sampler(SimpleVolume<VoxelType>* volume)
:mVolume(volume) //:mVolume(volume)
{ {
//Dodgy doing this - need to find how to call base constructor
mVolume = volume;
} }
template <typename VoxelType> template <typename VoxelType>

View File

@ -88,7 +88,7 @@ namespace PolyVox
inline VoxelType peekVoxel1px1py1pz(void) const; inline VoxelType peekVoxel1px1py1pz(void) const;
protected: protected:
DerivedVolumeType* m_pDerivedVolume; DerivedVolumeType* mVolume;
}; };
#endif #endif