Added template template parameters to CubicSurfaceExtractorWithNormals.

This commit is contained in:
David Williams 2011-04-30 22:46:45 +01:00
parent 87d97436ea
commit 36a9be83db
3 changed files with 8 additions and 8 deletions

View File

@ -83,7 +83,7 @@ int main(int argc, char *argv[])
//Extract the surface //Extract the surface
SurfaceMesh<PositionMaterialNormal> mesh; SurfaceMesh<PositionMaterialNormal> mesh;
CubicSurfaceExtractorWithNormals<SimpleVolume <MaterialDensityPair44>, MaterialDensityPair44 > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh); CubicSurfaceExtractorWithNormals<SimpleVolume, MaterialDensityPair44 > surfaceExtractor(&volData, volData.getEnclosingRegion(), &mesh);
surfaceExtractor.execute(); surfaceExtractor.execute();
//Pass the surface to the OpenGL window //Pass the surface to the OpenGL window

View File

@ -31,18 +31,18 @@ freely, subject to the following restrictions:
namespace PolyVox namespace PolyVox
{ {
template <typename VolumeType, typename VoxelType> template< template<typename> class VolumeType, typename VoxelType>
class CubicSurfaceExtractorWithNormals class CubicSurfaceExtractorWithNormals
{ {
public: public:
CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result); CubicSurfaceExtractorWithNormals(VolumeType<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result);
void execute(); void execute();
private: private:
//The volume data and a sampler to access it. //The volume data and a sampler to access it.
VolumeType* m_volData; VolumeType<VoxelType>* m_volData;
typename VolumeType::Sampler m_sampVolume; typename VolumeType<VoxelType>::Sampler m_sampVolume;
//The surface patch we are currently filling. //The surface patch we are currently filling.
SurfaceMesh<PositionMaterialNormal>* m_meshCurrent; SurfaceMesh<PositionMaterialNormal>* m_meshCurrent;

View File

@ -29,8 +29,8 @@ freely, subject to the following restrictions:
namespace PolyVox namespace PolyVox
{ {
template <typename VolumeType, typename VoxelType> template< template<typename> class VolumeType, typename VoxelType>
CubicSurfaceExtractorWithNormals<VolumeType, VoxelType>::CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result) CubicSurfaceExtractorWithNormals<VolumeType, VoxelType>::CubicSurfaceExtractorWithNormals(VolumeType<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result)
:m_volData(volData) :m_volData(volData)
,m_sampVolume(volData) ,m_sampVolume(volData)
,m_regSizeInVoxels(region) ,m_regSizeInVoxels(region)
@ -39,7 +39,7 @@ namespace PolyVox
m_meshCurrent->clear(); m_meshCurrent->clear();
} }
template <typename VolumeType, typename VoxelType> template< template<typename> class VolumeType, typename VoxelType>
void CubicSurfaceExtractorWithNormals<VolumeType, VoxelType>::execute() void CubicSurfaceExtractorWithNormals<VolumeType, VoxelType>::execute()
{ {
for(int32_t z = m_regSizeInVoxels.getLowerCorner().getZ(); z < m_regSizeInVoxels.getUpperCorner().getZ(); z++) for(int32_t z = m_regSizeInVoxels.getLowerCorner().getZ(); z < m_regSizeInVoxels.getUpperCorner().getZ(); z++)