PolyVox
0.2.1
Open source voxel management library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
PolyVoxCore
include
PolyVoxCore
Region.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_Region_H__
25
#define __PolyVox_Region_H__
26
27
#include "
Impl/TypeDef.h
"
28
29
#include "
PolyVoxCore/Vector.h
"
30
31
namespace
PolyVox
32
{
48
#ifdef SWIG
49
class
Region
50
#else
51
class
POLYVOX_API
Region
52
#endif
53
{
54
public
:
55
56
static
const
Region
MaxRegion
;
57
58
Region
();
59
Region
(
const
Vector3DInt32
& v3dLowerCorner,
const
Vector3DInt32
& v3dUpperCorner);
60
Region
(
int32_t
iLowerX,
int32_t
iLowerY,
int32_t
iLowerZ,
int32_t
iUpperX,
int32_t
iUpperY,
int32_t
iUpperZ);
61
63
bool
operator==
(
const
Region
& rhs)
const
;
65
bool
operator!=
(
const
Region
& rhs)
const
;
66
67
const
Vector3DInt32
&
getLowerCorner
(
void
)
const
;
68
const
Vector3DInt32
&
getUpperCorner
(
void
)
const
;
69
71
int32_t
getWidthInVoxels
(
void
)
const
;
73
int32_t
getHeightInVoxels
(
void
)
const
;
75
int32_t
getDepthInVoxels
(
void
)
const
;
77
Vector3DInt32
getDimensionsInVoxels
(
void
)
const
;
78
80
int32_t
getWidthInCells
(
void
)
const
;
82
int32_t
getHeightInCells
(
void
)
const
;
84
int32_t
getDepthInCells
(
void
)
const
;
86
Vector3DInt32
getDimensionsInCells
(
void
)
const
;
87
88
void
setLowerCorner
(
const
Vector3DInt32
& v3dLowerCorner);
89
void
setUpperCorner
(
const
Vector3DInt32
& v3dUpperCorner);
90
91
bool
containsPoint
(
const
Vector3DFloat
& pos,
float
boundary = 0.0f)
const
;
92
bool
containsPoint
(
const
Vector3DInt32
& pos, uint8_t boundary = 0)
const
;
93
//FIXME - Don't like these. Make containsPoint take flags indicating which axes to check?
94
bool
containsPointInX
(
float
pos,
float
boundary = 0.0f)
const
;
95
bool
containsPointInX
(
int32_t
pos, uint8_t boundary = 0)
const
;
96
bool
containsPointInY
(
float
pos,
float
boundary = 0.0f)
const
;
97
bool
containsPointInY
(
int32_t
pos, uint8_t boundary = 0)
const
;
98
bool
containsPointInZ
(
float
pos,
float
boundary = 0.0f)
const
;
99
bool
containsPointInZ
(
int32_t
pos, uint8_t boundary = 0)
const
;
100
void
cropTo
(
const
Region
& other);
102
POLYVOX_DEPRECATED
int32_t
depth(
void
)
const
;
104
POLYVOX_DEPRECATED
int32_t
height(
void
)
const
;
105
void
shift
(
const
Vector3DInt32
& amount);
106
void
shiftLowerCorner
(
const
Vector3DInt32
& amount);
107
void
shiftUpperCorner
(
const
Vector3DInt32
& amount);
108
//FIXME - Add dilate and erode functions?
110
POLYVOX_DEPRECATED
Vector3DInt32
dimensions(
void
);
112
POLYVOX_DEPRECATED
int32_t
width(
void
)
const
;
113
114
private
:
115
Vector3DInt32
m_v3dLowerCorner;
116
Vector3DInt32
m_v3dUpperCorner;
117
118
//FIXME - This variable is unused, but without it the OpenGL example crashes in release mode
119
//when the volume size is 128^3 and the level of detail is 2. Very strange, but consistant.
120
//Presubablly some kind of alignment issue? It started after this class was changed to use
121
//int16's rather than int32's. To be investigated.
122
uint8_t dummy;
123
};
124
}
125
126
#endif
Generated by
1.8.1