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>
{
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> >
#endif
{
public:
Sampler(LargeVolume<VoxelType>* volume);
@ -203,7 +207,7 @@ namespace PolyVox
private:
//The current volume
LargeVolume<VoxelType>* mVolume;
//LargeVolume<VoxelType>* mVolume;
//The current position in the volume
int32_t mXPosInVolume;

View File

@ -36,8 +36,10 @@ namespace PolyVox
{
template <typename VoxelType>
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>

View File

@ -38,7 +38,11 @@ namespace PolyVox
{
public:
#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> >
#endif
{
public:
Sampler(RawVolume<VoxelType>* volume);
@ -92,7 +96,7 @@ namespace PolyVox
private:
//The current volume
RawVolume<VoxelType>* mVolume;
//RawVolume<VoxelType>* mVolume;
//The current position in the volume
int32_t mXPosInVolume;

View File

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

View File

@ -60,7 +60,11 @@ namespace PolyVox
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> >
#endif
{
public:
Sampler(SimpleVolume<VoxelType>* volume);
@ -118,7 +122,7 @@ namespace PolyVox
private:
//The current volume
SimpleVolume<VoxelType>* mVolume;
//SimpleVolume<VoxelType>* mVolume;
//The current position in the volume
int32_t mXPosInVolume;

View File

@ -36,8 +36,10 @@ namespace PolyVox
{
template <typename VoxelType>
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>

View File

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