PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNMPhysicsJointBall.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLPHYSICS_SCENENODEMODIFIERS_JOINTBALL_H__ 00024 #define __PLPHYSICS_SCENENODEMODIFIERS_JOINTBALL_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLMath/Vector3.h> 00032 #include "PLPhysics/SceneNodeModifiers/SNMPhysicsJoint.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLPhysics { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * Physics ball and socket joint scene node modifier 00047 * 00048 * @note 00049 * - All non-zero value for 'MaxConeAngle' are clamped between 5 degree and 175 degrees 00050 * - Don't use 'NewtonBallSetConeLimits()' directly within your code, instead use the RTTI to set the variables 00051 * (... else this RTTI variables may have wrong values...) 00052 */ 00053 class SNMPhysicsJointBall : public SNMPhysicsJoint { 00054 00055 00056 //[-------------------------------------------------------] 00057 //[ RTTI interface ] 00058 //[-------------------------------------------------------] 00059 pl_class(PLPHYSICS_RTTI_EXPORT, SNMPhysicsJointBall, "PLPhysics", PLPhysics::SNMPhysicsJoint, "Physics ball and socket joint scene node modifier") 00060 // Attributes 00061 pl_attribute(PivotPoint, PLMath::Vector3, PLMath::Vector3::Zero, ReadWrite, GetSet, "Origin of the ball and socket in local space", "") 00062 pl_attribute(PinDir, PLMath::Vector3, PLMath::Vector3::UnitY, ReadWrite, GetSet, "Vector defining the cone axis in scene container space if the 'LocalPinDirection'-flag is not set, else in local scene node space", "") 00063 // [TODO] Implement me 00064 // DEFINE_VAR(PL_VAR_FLOAT, m_fMaxConeAngle, "MaxConeAngle", "0.0", "Max angle in degree the attached body is allow to swing relative to the pin axis, a value of zero will disable this limits", "", "") 00065 // DEFINE_VAR(PL_VAR_FLOAT, m_fMaxTwistAngle, "MaxTwistAngle", "0.0", "Max angle in degree the attached body is allow to twist relative to the pin axis, a value of zero will disable this limits", "", "") 00066 // Constructors 00067 pl_constructor_1(ParameterConstructor, PLScene::SceneNode&, "Parameter constructor", "") 00068 pl_class_end 00069 00070 00071 //[-------------------------------------------------------] 00072 //[ Public RTTI get/set functions ] 00073 //[-------------------------------------------------------] 00074 public: 00075 PLPHYSICS_API const PLMath::Vector3 &GetPivotPoint() const; 00076 PLPHYSICS_API void SetPivotPoint(const PLMath::Vector3 &vValue); 00077 PLPHYSICS_API const PLMath::Vector3 &GetPinDir() const; 00078 PLPHYSICS_API void SetPinDir(const PLMath::Vector3 &vValue); 00079 00080 00081 //[-------------------------------------------------------] 00082 //[ Public functions ] 00083 //[-------------------------------------------------------] 00084 public: 00085 /** 00086 * @brief 00087 * Constructor 00088 * 00089 * @param[in] cSceneNode 00090 * Owner scene node 00091 */ 00092 PLPHYSICS_API SNMPhysicsJointBall(PLScene::SceneNode &cSceneNode); 00093 00094 /** 00095 * @brief 00096 * Destructor 00097 */ 00098 PLPHYSICS_API virtual ~SNMPhysicsJointBall(); 00099 00100 00101 //[-------------------------------------------------------] 00102 //[ Private data ] 00103 //[-------------------------------------------------------] 00104 private: 00105 PLMath::Vector3 m_vPivotPoint; /**< Origin of the ball and socket in local space */ 00106 PLMath::Vector3 m_vPinDir; /**< Vector defining the cone axis in local space */ 00107 // [TODO] Implement me 00108 // float m_fMaxConeAngle; 00109 // float m_fMaxTwistAngle; 00110 00111 00112 //[-------------------------------------------------------] 00113 //[ Private virtual SNMPhysicsJoint functions ] 00114 //[-------------------------------------------------------] 00115 private: 00116 virtual void CreatePhysicsJoint() override; 00117 00118 00119 }; 00120 00121 00122 //[-------------------------------------------------------] 00123 //[ Namespace ] 00124 //[-------------------------------------------------------] 00125 } // PLPhysics 00126 00127 00128 #endif // __PLPHYSICS_SCENENODEMODIFIERS_JOINTBALL_H__
|