Planeshift
InputGeom.h
Go to the documentation of this file.
1
//
2
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
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
// Permission is granted to anyone to use this software for any purpose,
8
// including commercial applications, and to alter it and redistribute it
9
// freely, subject to the following restrictions:
10
// 1. The origin of this software must not be misrepresented; you must not
11
// claim that you wrote the original software. If you use this software
12
// in a product, an acknowledgment in the product documentation would be
13
// appreciated but is not required.
14
// 2. Altered source versions must be plainly marked as such, and must not be
15
// misrepresented as being the original software.
16
// 3. This notice may not be removed or altered from any source distribution.
17
//
18
19
#ifndef INPUTGEOM_H
20
#define INPUTGEOM_H
21
22
#include "
ChunkyTriMesh.h
"
23
#include "
MeshLoaderObj.h
"
24
25
static
const
int
MAX_CONVEXVOL_PTS
= 12;
26
struct
ConvexVolume
27
{
28
float
verts
[MAX_CONVEXVOL_PTS*3];
29
float
hmin
,
hmax
;
30
int
nverts
;
31
int
area
;
32
};
33
34
class
InputGeom
35
{
36
rcChunkyTriMesh
* m_chunkyMesh;
37
rcMeshLoaderObj
* m_mesh;
38
float
m_meshBMin[3], m_meshBMax[3];
39
42
static
const
int
MAX_OFFMESH_CONNECTIONS = 256;
43
float
m_offMeshConVerts[MAX_OFFMESH_CONNECTIONS*3*2];
44
float
m_offMeshConRads[MAX_OFFMESH_CONNECTIONS];
45
unsigned
char
m_offMeshConDirs[MAX_OFFMESH_CONNECTIONS];
46
unsigned
char
m_offMeshConAreas[MAX_OFFMESH_CONNECTIONS];
47
unsigned
short
m_offMeshConFlags[MAX_OFFMESH_CONNECTIONS];
48
unsigned
int
m_offMeshConId[MAX_OFFMESH_CONNECTIONS];
49
int
m_offMeshConCount;
51
54
static
const
int
MAX_VOLUMES = 256;
55
ConvexVolume
m_volumes[MAX_VOLUMES];
56
int
m_volumeCount;
58
59
public
:
60
InputGeom
();
61
~
InputGeom
();
62
63
bool
loadMesh(
class
rcContext
* ctx,
const
char
* filepath);
64
65
bool
load(
class
rcContext
* ctx,
const
char
* filepath);
66
bool
save(
const
char
* filepath);
67
69
inline
const
rcMeshLoaderObj
*
getMesh
()
const
{
return
m_mesh; }
70
inline
const
float
*
getMeshBoundsMin
()
const
{
return
m_meshBMin; }
71
inline
const
float
*
getMeshBoundsMax
()
const
{
return
m_meshBMax; }
72
inline
const
rcChunkyTriMesh
*
getChunkyMesh
()
const
{
return
m_chunkyMesh; }
73
bool
raycastMesh(
float
* src,
float
* dst,
float
& tmin);
74
77
int
getOffMeshConnectionCount
()
const
{
return
m_offMeshConCount; }
78
const
float
*
getOffMeshConnectionVerts
()
const
{
return
m_offMeshConVerts; }
79
const
float
*
getOffMeshConnectionRads
()
const
{
return
m_offMeshConRads; }
80
const
unsigned
char
*
getOffMeshConnectionDirs
()
const
{
return
m_offMeshConDirs; }
81
const
unsigned
char
*
getOffMeshConnectionAreas
()
const
{
return
m_offMeshConAreas; }
82
const
unsigned
short
*
getOffMeshConnectionFlags
()
const
{
return
m_offMeshConFlags; }
83
const
unsigned
int
*
getOffMeshConnectionId
()
const
{
return
m_offMeshConId; }
84
void
addOffMeshConnection(
const
float
* spos,
const
float
* epos,
const
float
rad,
85
unsigned
char
bidir,
unsigned
char
area
,
unsigned
short
flags);
86
void
deleteOffMeshConnection(
int
i);
87
void
drawOffMeshConnections(
struct
duDebugDraw
* dd,
bool
hilight =
false
);
89
92
int
getConvexVolumeCount
()
const
{
return
m_volumeCount; }
93
const
ConvexVolume
*
getConvexVolumes
()
const
{
return
m_volumes; }
94
void
addConvexVolume(
const
float
*
verts
,
const
int
nverts
,
95
const
float
minh,
const
float
maxh,
unsigned
char
area);
96
void
deleteConvexVolume(
int
i);
97
void
drawConvexVolumes(
struct
duDebugDraw
* dd,
bool
hilight =
false
);
99
};
100
101
#endif // INPUTGEOM_H
InputGeom::getMeshBoundsMax
const float * getMeshBoundsMax() const
Definition:
InputGeom.h:71
rcChunkyTriMesh
Definition:
ChunkyTriMesh.h:28
InputGeom::getOffMeshConnectionAreas
const unsigned char * getOffMeshConnectionAreas() const
Definition:
InputGeom.h:81
rcContext
Provides an interface for optional logging and performance tracking of the Recast build process...
Definition:
Recast.h:101
InputGeom
Definition:
InputGeom.h:34
ConvexVolume
Definition:
InputGeom.h:26
InputGeom::getChunkyMesh
const rcChunkyTriMesh * getChunkyMesh() const
Definition:
InputGeom.h:72
InputGeom::getConvexVolumes
const ConvexVolume * getConvexVolumes() const
Definition:
InputGeom.h:93
InputGeom::getOffMeshConnectionRads
const float * getOffMeshConnectionRads() const
Definition:
InputGeom.h:79
ConvexVolume::area
int area
Definition:
InputGeom.h:31
MeshLoaderObj.h
ConvexVolume::hmin
float hmin
Definition:
InputGeom.h:29
ConvexVolume::hmax
float hmax
Definition:
InputGeom.h:29
ConvexVolume::nverts
int nverts
Definition:
InputGeom.h:30
InputGeom::getOffMeshConnectionVerts
const float * getOffMeshConnectionVerts() const
Definition:
InputGeom.h:78
InputGeom::getOffMeshConnectionCount
int getOffMeshConnectionCount() const
Definition:
InputGeom.h:77
InputGeom::getConvexVolumeCount
int getConvexVolumeCount() const
Definition:
InputGeom.h:92
MAX_CONVEXVOL_PTS
static const int MAX_CONVEXVOL_PTS
Definition:
InputGeom.h:25
InputGeom::getMesh
const rcMeshLoaderObj * getMesh() const
Method to return static mesh data.
Definition:
InputGeom.h:69
InputGeom::getOffMeshConnectionFlags
const unsigned short * getOffMeshConnectionFlags() const
Definition:
InputGeom.h:82
InputGeom::getOffMeshConnectionId
const unsigned int * getOffMeshConnectionId() const
Definition:
InputGeom.h:83
ConvexVolume::verts
float verts[MAX_CONVEXVOL_PTS *3]
Definition:
InputGeom.h:28
duDebugDraw
Abstract debug draw interface.
Definition:
DebugDraw.h:34
rcMeshLoaderObj
Definition:
MeshLoaderObj.h:22
ChunkyTriMesh.h
InputGeom::getMeshBoundsMin
const float * getMeshBoundsMin() const
Definition:
InputGeom.h:70
InputGeom::getOffMeshConnectionDirs
const unsigned char * getOffMeshConnectionDirs() const
Definition:
InputGeom.h:80
plugins
common
recast
recastnavigation
InputGeom.h
Generated on Sat Jun 19 2021 05:00:31 for Planeshift by
1.8.11