PolyVox  0.3.0-dev
Open source voxel management library
CubicSurfaceExtractorWithNormals.h
Go to the documentation of this file.
1 /*******************************************************************************
2 Copyright (c) 2005-2009 David Williams
3 
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7 
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
11 
12  1. The origin of this software must not be misrepresented; you must not
13  claim that you wrote the original software. If you use this software
14  in a product, an acknowledgment in the product documentation would be
15  appreciated but is not required.
16 
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19 
20  3. This notice may not be removed or altered from any source
21  distribution.
22 *******************************************************************************/
23 
24 #ifndef __PolyVox_CubicSurfaceExtractorWithNormals_H__
25 #define __PolyVox_CubicSurfaceExtractorWithNormals_H__
26 
28 
29 #include "PolyVoxCore/Array.h"
30 #include "PolyVoxCore/BaseVolume.h" //For wrap modes... should move these?
32 
33 namespace PolyVox
34 {
35  template<typename VolumeType, typename IsQuadNeeded = DefaultIsQuadNeeded<typename VolumeType::VoxelType> >
37  {
38  public:
39  // This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template
40  // Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?
41 #if defined(_MSC_VER)
42  CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(), IsQuadNeeded isQuadNeeded = IsQuadNeeded());
43 #else
44  CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(), IsQuadNeeded isQuadNeeded = IsQuadNeeded());
45 #endif
46 
47  void execute();
48 
49  private:
50  IsQuadNeeded m_funcIsQuadNeededCallback;
51 
52  //The volume data and a sampler to access it.
53  VolumeType* m_volData;
54  typename VolumeType::Sampler m_sampVolume;
55 
56  //The surface patch we are currently filling.
58 
59  //Information about the region we are currently processing
60  Region m_regSizeInVoxels;
61 
62  //The wrap mode
63  WrapMode m_eWrapMode;
64  typename VolumeType::VoxelType m_tBorderValue;
65  };
66 }
67 
69 
70 #endif