RavEngine
Loading...
Searching...
No Matches
GuShapeConvex.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 GU_SHAPECONVEX_H
30#define GU_SHAPECONVEX_H
31
32#include "GuConvexMeshData.h"
33#include "CmScaling.h"
34
35namespace physx
36{
37namespace Gu
38{
39 struct PolygonalData;
40 typedef void (*HullPrefetchCB) (PxU32 numVerts, const PxVec3* PX_RESTRICT verts);
41 typedef void (*HullProjectionCB) (const PolygonalData& data, const PxVec3& dir, const PxMat34& world2hull, const Cm::FastVertex2ShapeScaling& scaling, PxReal& minimum, PxReal& maximum);
42 typedef PxU32 (*SelectClosestEdgeCB) (const PolygonalData& data, const Cm::FastVertex2ShapeScaling& scaling, const PxVec3& localDirection);
43
45 {
46 // Data
48 PxMeshScale mScale;
49 PxVec3 mCenter;
50 PxU32 mNbVerts;
51 PxU32 mNbPolygons;
52 PxU32 mNbEdges;
53 const Gu::HullPolygonData* mPolygons;
54 const PxVec3* mVerts;
55 const PxU8* mPolygonVertexRefs;
56 const PxU8* mFacesByEdges;
57 const PxU16* mVerticesByEdges;
58
59 union
60 {
61 const Gu::BigConvexRawData* mBigData; // Only for big convexes
62 const PxVec3* mHalfSide; // Only for boxes
63 };
64
65 // Code
66 HullProjectionCB mProjectHull;
67 SelectClosestEdgeCB mSelectClosestEdgeCB;
68
69 PX_FORCE_INLINE const PxU8* getPolygonVertexRefs(const Gu::HullPolygonData& poly) const
70 {
71 return mPolygonVertexRefs + poly.mVRef8;
72 }
73 };
74
75#if PX_VC
76 #pragma warning(push)
77 #pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class
78#endif
79 class PX_PHYSX_COMMON_API PolygonalBox
80 {
81 public:
82 PolygonalBox(const PxVec3& halfSide);
83
84 void getPolygonalData(PolygonalData* PX_RESTRICT dst) const;
85
86 const PxVec3& mHalfSide;
87 PxVec3 mVertices[8];
88 Gu::HullPolygonData mPolygons[6];
89 private:
90 PolygonalBox& operator=(const PolygonalBox&);
91 };
92#if PX_VC
93 #pragma warning(pop)
94#endif
95
96 void getPolygonalData_Convex(PolygonalData* PX_RESTRICT dst, const Gu::ConvexHullData* PX_RESTRICT src, const Cm::FastVertex2ShapeScaling& scaling);
97}
98}
99
100#endif
Definition CmScaling.h:61
Definition GuShapeConvex.h:80
A class expressing a nonuniform scaling transformation.
Definition PxMeshScale.h:69
3 Element vector class.
Definition PxVec3.h:50
#define PX_RESTRICT
Definition PxPreprocessor.h:355
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition GuBigConvexData.h:61
Definition GuConvexMeshData.h:109
Definition GuConvexMeshData.h:49
PxU16 mVRef8
Offset of vertex references in hull vertex data (CS: can we assume indices are tightly packed and off...
Definition GuConvexMeshData.h:62
Definition GuConvexMeshData.h:87
Definition GuShapeConvex.h:45