DestructibleActorJoint.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. 00003 * 00004 * NVIDIA CORPORATION and its licensors retain all intellectual property 00005 * and proprietary rights in and to this software, related documentation 00006 * and any modifications thereto. Any use, reproduction, disclosure or 00007 * distribution of this software and related documentation without an express 00008 * license agreement from NVIDIA CORPORATION is strictly prohibited. 00009 */ 00010 00011 00012 #ifndef DESTRUCTIBLE_ACTOR_JOINT_H 00013 #define DESTRUCTIBLE_ACTOR_JOINT_H 00014 00015 #include "ModuleDestructible.h" 00016 00017 #include "extensions/PxJoint.h" 00018 00019 00020 namespace nvidia 00021 { 00022 namespace apex 00023 { 00024 00025 PX_PUSH_PACK_DEFAULT 00026 00030 class DestructibleActorJointDesc : public ApexDesc 00031 { 00032 public: 00033 00037 PX_INLINE DestructibleActorJointDesc(); 00038 00042 PX_INLINE void setToDefault(); 00043 00047 PX_INLINE bool isValid() const; 00048 00052 physx::PxJointConcreteType::Enum type; 00056 PxRigidActor* actor[2]; 00060 PxVec3 localAxis[2]; 00064 PxVec3 localAnchor[2]; 00068 PxVec3 localNormal[2]; 00069 00074 DestructibleActor* destructible[2]; 00075 00083 int32_t attachmentChunkIndex[2]; 00084 00085 00095 PxVec3 globalAnchor[2]; 00096 00100 PxVec3 globalAxis[2]; 00101 00105 PxVec3 globalNormal[2]; 00106 }; 00107 00108 // DestructibleActorJointDesc inline functions 00109 00110 PX_INLINE DestructibleActorJointDesc::DestructibleActorJointDesc() : ApexDesc() 00111 { 00112 setToDefault(); 00113 } 00114 00115 PX_INLINE void DestructibleActorJointDesc::setToDefault() 00116 { 00117 ApexDesc::setToDefault(); 00118 for (int i=0; i<2; i++) 00119 { 00120 actor[i] = 0; 00121 localAxis[i] = PxVec3(0,0,1); 00122 localNormal[i] = PxVec3(1,0,0); 00123 localAnchor[i] = PxVec3(0); 00124 } 00125 for (int i = 0; i < 2; ++i) 00126 { 00127 destructible[i] = NULL; 00128 attachmentChunkIndex[i] = ModuleDestructibleConst::INVALID_CHUNK_INDEX; 00129 globalAnchor[i] = PxVec3(0.0f); 00130 globalAxis[i] = PxVec3(0.0f, 0.0f, 1.0f); 00131 globalNormal[i] = PxVec3(1.0f, 0.0f, 0.0f); 00132 } 00133 } 00134 00135 PX_INLINE bool DestructibleActorJointDesc::isValid() const 00136 { 00137 if (destructible[0] == NULL && destructible[1] == NULL) 00138 { 00139 return false; 00140 } 00141 00142 for (int i = 0; i < 2; ++i) 00143 { 00144 if (PxAbs(globalAxis[i].magnitudeSquared() - 1.0f) > 0.1f) 00145 { 00146 return false; 00147 } 00148 if (PxAbs(globalNormal[i].magnitudeSquared() - 1.0f) > 0.1f) 00149 { 00150 return false; 00151 } 00152 //check orthogonal pairs 00153 if (PxAbs(globalAxis[i].dot(globalNormal[i])) > 0.1f) 00154 { 00155 return false; 00156 } 00157 } 00158 00159 return ApexDesc::isValid(); 00160 } 00161 00162 00167 class DestructibleActorJoint : public ApexInterface 00168 { 00169 public: 00179 virtual PxJoint* joint() = 0; 00180 00181 protected: 00182 virtual ~DestructibleActorJoint() {} 00183 }; 00184 00185 PX_POP_PACK 00186 00187 } 00188 } // end namespace nvidia 00189 00190 #endif // DESTRUCTIBLE_ACTOR_JOINT_H
Generated on Fri Dec 15 2017 13:58:22 Copyright © 2012-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.