Main Page
Class Hierarchy
Compound List
Compound Members
Include
geometry
PxSimpleTriangleMesh.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3
*
4
* NVIDIA CORPORATION and its licensors retain all intellectual property
5
* and proprietary rights in and to this software, related documentation
6
* and any modifications thereto. Any use, reproduction, disclosure or
7
* distribution of this software and related documentation without an express
8
* license agreement from NVIDIA CORPORATION is strictly prohibited.
9
*/
10
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12
13
14
#ifndef PX_PHYSICS_GEOMUTILS_NX_SIMPLETRIANGLEMESH
15
#define PX_PHYSICS_GEOMUTILS_NX_SIMPLETRIANGLEMESH
16
20
#include "
foundation/PxVec3.h
"
21
#include "
foundation/PxFlags.h
"
22
#include "
common/PxCoreUtilityTypes.h
"
23
#include "
common/PxPhysXCommonConfig.h
"
24
25
#ifndef PX_DOXYGEN
26
namespace
physx
27
{
28
#endif
29
33
struct
PxMeshFlag
34
{
35
enum
Enum
36
{
50
eFLIPNORMALS = (1<<0),
51
e16_BIT_INDICES = (1<<1)
//<! Denotes the use of 16-bit vertex indices
52
};
53
};
54
60
typedef
PxFlags<PxMeshFlag::Enum,PxU16>
PxMeshFlags
;
61
PX_FLAGS_OPERATORS
(
PxMeshFlag::Enum
,
PxU16
)
62
63
64
67
class
PxSimpleTriangleMesh
68
{
69
public
:
70
74
PxBoundedData
points
;
75
91
PxBoundedData
triangles
;
92
96
PxMeshFlags
flags
;
97
101
PX_INLINE
PxSimpleTriangleMesh();
105
PX_INLINE
void
setToDefault();
109
PX_INLINE
bool
isValid()
const
;
110
};
111
112
113
PX_INLINE
PxSimpleTriangleMesh::PxSimpleTriangleMesh
()
114
{
115
}
116
117
PX_INLINE
void
PxSimpleTriangleMesh::setToDefault
()
118
{
119
*
this
=
PxSimpleTriangleMesh
();
120
}
121
122
PX_INLINE
bool
PxSimpleTriangleMesh::isValid
()
const
123
{
124
// Check geometry
125
if
(points.count > 0xffff &&
flags
&
PxMeshFlag::e16_BIT_INDICES
)
126
return
false
;
127
if
(!points.data)
128
return
false
;
129
if
(points.stride <
sizeof
(
PxVec3
))
//should be at least one point's worth of data
130
return
false
;
131
132
// Check topology
133
// The triangles pointer is not mandatory
134
if
(triangles.data)
135
{
136
// Indexed mesh
137
PxU32
limit = (
flags
&
PxMeshFlag::e16_BIT_INDICES
) ?
sizeof
(
PxU16
)*3 :
sizeof
(
PxU32
)*3;
138
if
(triangles.stride < limit)
139
return
false
;
140
}
141
return
true
;
142
}
143
144
#ifndef PX_DOXYGEN
145
}
// namespace physx
146
#endif
147
149
#endif
Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.
www.nvidia.com