PolyVox
0.3.0-dev
Open source voxel management library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
PolyVoxCore
include
PolyVoxCore
SurfaceMesh.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_SurfaceMesh_H__
25
#define __PolyVox_SurfaceMesh_H__
26
27
#include "
Impl/TypeDef.h
"
28
29
#include "
PolyVoxCore/Region.h
"
30
#include "
PolyVoxCore/VertexTypes.h
"
//Should probably do away with this on in the future...
31
32
#include <algorithm>
33
#include <cstdlib>
34
#include <list>
35
#include <memory>
36
#include <set>
37
#include <vector>
38
39
namespace
PolyVox
40
{
41
class
LodRecord
42
{
43
public
:
44
int
beginIndex
;
45
int
endIndex
;
//Let's put it just past the end STL style
46
};
47
48
template
<
typename
VertexType>
49
class
SurfaceMesh
50
{
51
public
:
52
SurfaceMesh
();
53
~SurfaceMesh
();
54
55
const
std::vector<uint32_t>&
getIndices
(
void
)
const
;
56
uint32_t
getNoOfIndices
(
void
)
const
;
57
uint32_t
getNoOfNonUniformTrianges
(
void
)
const
;
58
uint32_t
getNoOfUniformTrianges
(
void
)
const
;
59
uint32_t
getNoOfVertices
(
void
)
const
;
60
std::vector<VertexType>&
getRawVertexData
(
void
);
//FIXME - this should be removed
61
const
std::vector<VertexType>&
getVertices
(
void
)
const
;
62
63
void
addTriangle
(
uint32_t
index0,
uint32_t
index1,
uint32_t
index2);
64
void
addTriangleCubic
(
uint32_t
index0,
uint32_t
index1,
uint32_t
index2);
65
uint32_t
addVertex
(
const
VertexType& vertex);
66
void
clear
(
void
);
67
bool
isEmpty
(
void
)
const
;
68
69
void
scaleVertices
(
float
amount);
70
void
translateVertices
(
const
Vector3DFloat
& amount);
71
72
//THESE FUNCTIONS TO BE REMOVED IN THE FUTURE. OR AT LEAST MOVED OUT OF THIS CLASS INTO FREE FUNCTIONS.
73
//THEY ARE CAUSING PROBLEMS WITH THE SWIG BINDINGS. THE FUNCTIONS REGARDING NORMALS MAKE NO SENSE WHEN
74
//A VERTEX MIGHT NOT HAVE NORMALS. THE EXTRACT SUBSET FUNCTION SHOULD MAYBE BE APPLICATION CODE, AT ANY
75
//RATE THE STD::SET CAUSES PROBLEMS WITH SWIG. IF YOU UNCOMMENT ANY OF THESE FUNCTIONS, PLEASE POST ON
76
//THE FORUM SO WE CAN KNOW THE FUNCTIONALITY IS STILL NEEDED IN SOME FORM.
77
//void sumNearbyNormals(bool bNormaliseResult = true);
78
//polyvox_shared_ptr< SurfaceMesh<VertexType> > extractSubset(std::set<uint8_t> setMaterials);
79
//void generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices = false);
80
81
int
noOfDegenerateTris
(
void
);
82
void
removeDegenerateTris
(
void
);
83
void
removeUnusedVertices
(
void
);
84
85
Region
m_Region
;
86
87
int32_t
m_iTimeStamp
;
88
89
int32_t
m_iNoOfLod0Tris
;
90
91
public
:
92
std::vector<uint32_t>
m_vecTriangleIndices
;
93
std::vector<VertexType>
m_vecVertices
;
94
95
std::vector<LodRecord>
m_vecLodRecords
;
96
};
97
98
template
<
typename
VertexType>
99
polyvox_shared_ptr< SurfaceMesh<VertexType> >
extractSubset
(
SurfaceMesh<VertexType>
& inputMesh, std::set<uint8_t> setMaterials);
100
}
101
102
#include "
PolyVoxCore/SurfaceMesh.inl
"
103
104
#endif
/* __SurfaceMesh_H__ */
Generated by
1.8.2