aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/common/include/ApexShape.h
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/common/include/ApexShape.h
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'APEX_1.4/common/include/ApexShape.h')
-rw-r--r--APEX_1.4/common/include/ApexShape.h263
1 files changed, 263 insertions, 0 deletions
diff --git a/APEX_1.4/common/include/ApexShape.h b/APEX_1.4/common/include/ApexShape.h
new file mode 100644
index 00000000..f0e87b34
--- /dev/null
+++ b/APEX_1.4/common/include/ApexShape.h
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+
+#ifndef __APEX_SHAPE_H__
+#define __APEX_SHAPE_H__
+
+#include "Apex.h"
+#include "ApexUsingNamespace.h"
+#include "PsUserAllocated.h"
+#include "Shape.h"
+
+namespace nvidia
+{
+namespace apex
+{
+
+class ApexSphereShape : public SphereShape, public UserAllocated
+{
+private:
+ float mRadius;
+ PxMat44 mTransform4x4;
+ PxMat44 mOldTransform4x4;
+ PxBounds3 mBounds;
+
+ void calculateAABB();
+
+public:
+
+ ApexSphereShape();
+
+ virtual ~ApexSphereShape() {};
+
+ virtual void releaseApexShape()
+ {
+ delete this;
+ }
+
+ const ApexSphereShape* isSphereGeom() const
+ {
+ return this;
+ }
+
+ bool intersectAgainstAABB(PxBounds3 bounds);
+
+ PxBounds3 getAABB() const
+ {
+ return mBounds;
+ }
+
+ void setRadius(float radius);
+
+ float getRadius() const
+ {
+ return mRadius;
+ };
+
+ void setPose(PxMat44 pose);
+
+ PxMat44 getPose() const
+ {
+ return mTransform4x4;
+ }
+
+ PxMat44 getPreviousPose() const
+ {
+ return mOldTransform4x4;
+ }
+
+ void visualize(RenderDebugInterface* renderer) const;
+};
+
+//the capsule is oriented along the y axis by default and its total height is height+2*radius
+class ApexCapsuleShape : public CapsuleShape, public UserAllocated
+{
+private:
+
+ float mRadius;
+ float mHeight;
+ PxMat44 mTransform4x4;
+ PxMat44 mOldTransform4x4;
+ PxBounds3 mBounds;
+ void calculateAABB();
+
+public:
+
+ ApexCapsuleShape();
+
+ virtual ~ApexCapsuleShape() {};
+
+ virtual void releaseApexShape()
+ {
+ delete this;
+ }
+
+ const ApexCapsuleShape* isCapsuleGeom() const
+ {
+ return this;
+ }
+
+ bool intersectAgainstAABB(PxBounds3 bounds);
+
+ PxBounds3 getAABB() const
+ {
+ return mBounds;
+ }
+
+ void setDimensions(float height, float radius);
+
+ void getDimensions(float& height, float& radius) const
+ {
+ radius = mRadius;
+ height = mHeight;
+ };
+
+ void setPose(PxMat44 pose);
+
+ PxMat44 getPose() const
+ {
+ return mTransform4x4;
+ }
+
+ PxMat44 getPreviousPose() const
+ {
+ return mOldTransform4x4;
+ }
+
+ void visualize(RenderDebugInterface* renderer) const;
+};
+
+class ApexBoxShape : public BoxShape, public UserAllocated
+{
+private:
+
+ PxVec3 mSize;
+ PxMat44 mTransform4x4;
+ PxMat44 mOldTransform4x4;
+ PxBounds3 mBounds;
+ void calculateAABB();
+
+public:
+
+ ApexBoxShape();
+
+ virtual ~ApexBoxShape() {};
+
+ virtual void releaseApexShape()
+ {
+ delete this;
+ }
+
+ const ApexBoxShape* isBoxGeom() const
+ {
+ return this;
+ }
+
+ bool intersectAgainstAABB(PxBounds3 bounds);
+
+ PxBounds3 getAABB() const
+ {
+ return mBounds;
+ }
+
+ void setSize(PxVec3 size);
+
+ void setPose(PxMat44 pose);
+
+ PxMat44 getPose() const
+ {
+ return mTransform4x4;
+ }
+
+ PxMat44 getPreviousPose() const
+ {
+ return mOldTransform4x4;
+ }
+
+ PxVec3 getSize() const
+ {
+ return mSize;
+ }
+
+ void visualize(RenderDebugInterface* renderer) const;
+};
+
+class ApexHalfSpaceShape : public HalfSpaceShape, public UserAllocated
+{
+private:
+ PxVec3 mOrigin;
+ PxVec3 mPreviousOrigin;
+ PxVec3 mNormal;
+ PxVec3 mPreviousNormal;
+ bool isPointInside(PxVec3 pos);
+
+public:
+ ApexHalfSpaceShape();
+
+ virtual ~ApexHalfSpaceShape() {};
+
+ virtual void releaseApexShape()
+ {
+ delete this;
+ }
+
+ const ApexHalfSpaceShape* isHalfSpaceGeom() const
+ {
+ return this;
+ }
+
+ bool intersectAgainstAABB(PxBounds3 bounds);
+
+ PxBounds3 getAABB() const
+ {
+ return PxBounds3(PxVec3(0), PxVec3(PX_MAX_F32));
+ }
+
+ void setOriginAndNormal(PxVec3 origin, PxVec3 normal);
+
+ PxVec3 getNormal() const
+ {
+ return mNormal;
+ };
+
+ PxVec3 getPreviousNormal() const
+ {
+ return mPreviousNormal;
+ };
+
+ PxVec3 getOrigin() const
+ {
+ return mOrigin;
+ };
+
+ PxVec3 getPreviousOrigin() const
+ {
+ return mPreviousOrigin;
+ };
+
+ PxMat44 getPose() const;
+
+ PxMat44 getPreviousPose() const;
+
+ void visualize(RenderDebugInterface* renderer) const;
+
+ virtual void setPose(PxMat44 pose)
+ {
+ PX_UNUSED(pose);
+ //dummy
+ }
+};
+
+
+}
+} // end namespace nvidia::apex
+
+#endif