RavEngine
Loading...
Searching...
No Matches
GuConvexSupportTable.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_CONVEX_SUPPORT_TABLE_H
30#define GU_CONVEX_SUPPORT_TABLE_H
31
32#include "common/PxPhysXCommonConfig.h"
33#include "GuVecConvex.h"
34#include "foundation/PxVecTransform.h"
35
36namespace physx
37{
38namespace Gu
39{
40
41 class TriangleV;
42 class CapsuleV;
43 class BoxV;
44 class ConvexHullV;
45 class ConvexHullNoScaleV;
46
47#if PX_VC
48 #pragma warning(push)
49 #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value.
50#endif
52 {
53 public:
54 aos::Vec3V shapeSpaceCenterOfMass;
55 const aos::PxTransformV& transform;
56 const aos::Mat33V& vertex2Shape;
57 const aos::Mat33V& shape2Vertex;
58 const bool isIdentityScale;
59
60 SupportLocal(const aos::PxTransformV& _transform, const aos::Mat33V& _vertex2Shape, const aos::Mat33V& _shape2Vertex, const bool _isIdentityScale = true): transform(_transform),
61 vertex2Shape(_vertex2Shape), shape2Vertex(_shape2Vertex), isIdentityScale(_isIdentityScale)
62 {
63 }
64
65 PX_FORCE_INLINE void setShapeSpaceCenterofMass(const aos::Vec3VArg _shapeSpaceCenterOfMass)
66 {
67 shapeSpaceCenterOfMass = _shapeSpaceCenterOfMass;
68 }
69 virtual ~SupportLocal() {}
70 virtual aos::Vec3V doSupport(const aos::Vec3VArg dir) const = 0;
71 virtual void doSupport(const aos::Vec3VArg dir, aos::FloatV& min, aos::FloatV& max) const = 0;
72 virtual void populateVerts(const PxU8* inds, PxU32 numInds, const PxVec3* originalVerts, aos::Vec3V* verts)const = 0;
73
74 protected:
75 SupportLocal& operator=(const SupportLocal&);
76 };
77#if PX_VC
78 #pragma warning(pop)
79#endif
80
81 template <typename Convex>
83 {
84
85 public:
86 const Convex& conv;
87 SupportLocalImpl(const Convex& _conv, const aos::PxTransformV& _transform, const aos::Mat33V& _vertex2Shape, const aos::Mat33V& _shape2Vertex, const bool _isIdentityScale = true) :
88 SupportLocal(_transform, _vertex2Shape, _shape2Vertex, _isIdentityScale), conv(_conv)
89 {
90 }
91
92 aos::Vec3V doSupport(const aos::Vec3VArg dir) const
93 {
94 //return conv.supportVertsLocal(dir);
95 return conv.supportLocal(dir);
96 }
97
98 void doSupport(const aos::Vec3VArg dir, aos::FloatV& min, aos::FloatV& max) const
99 {
100 return conv.supportLocal(dir, min, max);
101 }
102
103 void populateVerts(const PxU8* inds, PxU32 numInds, const PxVec3* originalVerts, aos::Vec3V* verts) const
104 {
105 conv.populateVerts(inds, numInds, originalVerts, verts);
106 }
107
108 protected:
109 SupportLocalImpl& operator=(const SupportLocalImpl&);
110
111 };
112}
113
114}
115
116#endif
Definition GuConvexSupportTable.h:83
Definition GuConvexSupportTable.h:52
3 Element vector class.
Definition PxVec3.h:50
Definition PxVecTransform.h:43
#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 PxVecMathAoSScalar.h:52
Definition PxVecMathAoSScalar.h:101
Definition PxVecMathAoSScalar.h:77