Shape.h
Go to the documentation of this file.
00001 //
00002 // Redistribution and use in source and binary forms, with or without
00003 // modification, are permitted provided that the following conditions
00004 // are met:
00005 //  * Redistributions of source code must retain the above copyright
00006 //    notice, this list of conditions and the following disclaimer.
00007 //  * Redistributions in binary form must reproduce the above copyright
00008 //    notice, this list of conditions and the following disclaimer in the
00009 //    documentation and/or other materials provided with the distribution.
00010 //  * Neither the name of NVIDIA CORPORATION nor the names of its
00011 //    contributors may be used to endorse or promote products derived
00012 //    from this software without specific prior written permission.
00013 //
00014 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
00015 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017 // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00018 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 //
00026 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
00027 
00028 
00029 
00030 #ifndef SHAPE_H
00031 #define SHAPE_H
00032 
00038 #include "foundation/PxPreprocessor.h"
00039 #include "ApexUsingNamespace.h"
00040 
00041 #include "ApexDefs.h"
00042 
00043 /*#if PX_PHYSICS_VERSION_MAJOR < 3
00044 #include "Nxp.h"
00045 #endif*/
00046 
00047 namespace nvidia
00048 {
00049 namespace apex
00050 {
00051 
00052 PX_PUSH_PACK_DEFAULT
00053 
00054 
00055 class SphereShape;
00056 class CapsuleShape;
00057 class BoxShape;
00058 class HalfSpaceShape;
00059 class RenderDebugInterface;
00060 
00064 class Shape
00065 {
00066 public:
00067 
00069     virtual bool intersectAgainstAABB(PxBounds3) = 0;
00070 
00072     virtual PxBounds3 getAABB() const = 0;
00073 
00075     virtual const BoxShape* isBoxGeom() const
00076     {
00077         return NULL;
00078     }
00079 
00081     virtual const SphereShape* isSphereGeom() const
00082     {
00083         return NULL;
00084     }
00085 
00087     virtual const CapsuleShape* isCapsuleGeom() const
00088     {
00089         return NULL;
00090     }
00091 
00093     virtual const HalfSpaceShape* isHalfSpaceGeom() const
00094     {
00095         return NULL;
00096     }
00097 
00099     virtual void releaseApexShape() = 0;
00100 
00102     virtual void visualize(RenderDebugInterface* renderer) const = 0;
00103 
00105     virtual PxMat44 getPose() const = 0;
00106 
00108     virtual void setPose(PxMat44 pose) = 0;
00109 
00111     virtual PxMat44 getPreviousPose() const = 0;
00112 };
00113 
00115 class SphereShape : public Shape
00116 {
00117 public:
00119     virtual float getRadius() const = 0;
00120 
00122     virtual void setRadius(float radius) = 0;
00123 
00124 };
00125 
00127 class CapsuleShape : public Shape
00128 {
00129 public:
00131     virtual void getDimensions(float& height, float& radius) const = 0;
00132 
00134     virtual void setDimensions(float height, float radius) = 0;
00135 
00136 };
00137 
00139 class BoxShape : public Shape
00140 {
00141 public:
00144     virtual void setSize(PxVec3 size) = 0;
00145 
00147     virtual PxVec3 getSize() const = 0;
00148 
00149 };
00150 
00152 class HalfSpaceShape : public Shape
00153 {
00154 public:
00156     virtual void setOriginAndNormal(PxVec3 origin, PxVec3 normal) = 0;
00157 
00159     virtual PxVec3 getNormal() const = 0;
00160 
00162     virtual PxVec3 getOrigin() const = 0;
00163 
00165     virtual PxVec3 getPreviousOrigin() const = 0;
00166 };
00167 
00168 
00169 PX_POP_PACK
00170 
00171 }
00172 } // end namespace nvidia::apex
00173 
00174 #endif // SHAPE_H

Generated on Sat Dec 1 2018 15:52:06

Copyright © 2012-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.