RavEngine
Loading...
Searching...
No Matches
PxTriangleMeshGeometry.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_TRIANGLE_MESH_GEOMETRY_H
30#define PX_TRIANGLE_MESH_GEOMETRY_H
34#include "geometry/PxGeometry.h"
35#include "geometry/PxMeshScale.h"
36#include "common/PxCoreUtilityTypes.h"
37
38#if !PX_DOXYGEN
39namespace physx
40{
41#endif
42
43class PxTriangleMesh;
44
51{
52 enum Enum
53 {
54 eTIGHT_BOUNDS = (1<<0),
55 eDOUBLE_SIDED = (1<<1)
58 };
59};
60
67PX_FLAGS_OPERATORS(PxMeshGeometryFlag::Enum,PxU8)
68
69
81{
82public:
91 const PxMeshScale& scaling = PxMeshScale(),
93 PxGeometry (PxGeometryType::eTRIANGLEMESH),
94 scale (scaling),
95 meshFlags (flags),
96 triangleMesh(mesh)
97 {}
98
105 PxGeometry (that),
106 scale (that.scale),
107 meshFlags (that.meshFlags),
108 triangleMesh(that.triangleMesh)
109 {}
110
115 {
116 mType = that.mType;
117 scale = that.scale;
118 meshFlags = that.meshFlags;
119 triangleMesh = that.triangleMesh;
120 }
121
132 PX_INLINE bool isValid() const;
133
134public:
139};
140
142{
143 if(mType != PxGeometryType::eTRIANGLEMESH)
144 return false;
146 return false;
147 if(!scale.isValidForTriangleMesh())
148 return false;
149 if(!triangleMesh)
150 return false;
151
152 return true;
153}
154
155#if !PX_DOXYGEN
156} // namespace physx
157#endif
158
160#endif
Container for bitfield flag variables associated with a specific enum type.
Definition PxFlags.h:73
A geometry object.
Definition PxGeometry.h:79
A class expressing a nonuniform scaling transformation.
Definition PxMeshScale.h:69
PxQuat rotation
The orientation of the scaling axes.
Definition PxMeshScale.h:164
PxVec3 scale
A nonuniform scaling.
Definition PxMeshScale.h:163
PX_CUDA_CALLABLE bool isUnit() const
returns true if finite and magnitude is close to unit
Definition PxQuat.h:132
Triangle mesh geometry class.
Definition PxTriangleMeshGeometry.h:81
PX_INLINE void operator=(const PxTriangleMeshGeometry &that)
Assignment operator.
Definition PxTriangleMeshGeometry.h:114
PX_INLINE PxTriangleMeshGeometry(const PxTriangleMeshGeometry &that)
Copy constructor.
Definition PxTriangleMeshGeometry.h:104
PxMeshGeometryFlags meshFlags
Mesh flags.
Definition PxTriangleMeshGeometry.h:136
PxTriangleMesh * triangleMesh
A reference to the mesh object.
Definition PxTriangleMeshGeometry.h:138
PxPadding< 3 > paddingFromFlags
padding for mesh flags
Definition PxTriangleMeshGeometry.h:137
PX_INLINE bool isValid() const
Returns true if the geometry is valid.
Definition PxTriangleMeshGeometry.h:141
PX_INLINE PxTriangleMeshGeometry(PxTriangleMesh *mesh=NULL, const PxMeshScale &scaling=PxMeshScale(), PxMeshGeometryFlags flags=PxMeshGeometryFlags())
Constructor. By default creates an empty object with a NULL mesh and identity scale.
Definition PxTriangleMeshGeometry.h:90
PxMeshScale scale
The scaling transformation.
Definition PxTriangleMeshGeometry.h:135
A triangle mesh, also called a 'polygon soup'.
Definition PxTriangleMesh.h:118
PX_CUDA_CALLABLE PX_INLINE bool isFinite() const
returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)
Definition PxVec3.h:156
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxFlags< PxMeshGeometryFlag::Enum, PxU8 > PxMeshGeometryFlags
collection of set bits defined in PxMeshGeometryFlag.
Definition PxTriangleMeshGeometry.h:66
A geometry type.
Definition PxGeometry.h:50
Flags controlling the simulated behavior of the triangle mesh geometry.
Definition PxTriangleMeshGeometry.h:51
Enum
Definition PxTriangleMeshGeometry.h:53
@ eTIGHT_BOUNDS
Use tighter (but more expensive to compute) bounds around the triangle mesh geometry.
Definition PxTriangleMeshGeometry.h:54
@ eDOUBLE_SIDED
Definition PxTriangleMeshGeometry.h:55
Definition PxCoreUtilityTypes.h:103