PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: JointHinge.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_JOINTHINGE_H__ 00024 #define __PLPHYSICS_JOINTHINGE_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLMath/Vector3.h> 00032 #include "PLPhysics/Joint.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLPhysics { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * Abstract PL physics hinge (other name: revolute) joint 00047 * 00048 * @remarks 00049 * DOFs removed: 5 DOFs remaining: 1 00050 */ 00051 class JointHinge : public Joint { 00052 00053 00054 //[-------------------------------------------------------] 00055 //[ Public functions ] 00056 //[-------------------------------------------------------] 00057 public: 00058 /** 00059 * @brief 00060 * Destructor 00061 */ 00062 PLPHYSICS_API virtual ~JointHinge(); 00063 00064 /** 00065 * @brief 00066 * Returns the origin of the hinge in world space 00067 * 00068 * @return 00069 * The origin of the hinge in world space 00070 */ 00071 PLPHYSICS_API const PLMath::Vector3 &GetPivotPoint() const; 00072 00073 /** 00074 * @brief 00075 * Returns the line of action of the hinge in world space 00076 * 00077 * @return 00078 * The line of action of the hinge in world space 00079 */ 00080 PLPHYSICS_API const PLMath::Vector3 &GetPinDir() const; 00081 00082 /** 00083 * @brief 00084 * Returns the low range 00085 * 00086 * @return 00087 * The low range in degree 00088 */ 00089 PLPHYSICS_API float GetLowRange() const; 00090 00091 /** 00092 * @brief 00093 * Sets the low range 00094 * 00095 * @param[in] fLowRange 00096 * New low range in degree 00097 */ 00098 PLPHYSICS_API void SetLowRange(float fLowRange = -180.0f); 00099 00100 /** 00101 * @brief 00102 * Returns the high range 00103 * 00104 * @return 00105 * The high range in degree 00106 */ 00107 PLPHYSICS_API float GetHighRange() const; 00108 00109 /** 00110 * @brief 00111 * Sets the high range 00112 * 00113 * @param[in] fHighRange 00114 * New high range in degree 00115 */ 00116 PLPHYSICS_API void SetHighRange(float fHighRange = 180.0f); 00117 00118 00119 //[-------------------------------------------------------] 00120 //[ Public virtual JointHinge functions ] 00121 //[-------------------------------------------------------] 00122 public: 00123 /** 00124 * @brief 00125 * Adds omega to the bodies assigned with this joint 00126 * 00127 * @param[in] fOmega 00128 * Omega to add 00129 */ 00130 virtual void AddOmega(float fOmega) = 0; 00131 00132 00133 //[-------------------------------------------------------] 00134 //[ Protected functions ] 00135 //[-------------------------------------------------------] 00136 protected: 00137 /** 00138 * @brief 00139 * Constructor 00140 * 00141 * @param[in] cWorld 00142 * World this joint is in 00143 * @param[in] cJointImpl 00144 * Reference to the physics API specific joint implementation 00145 * @param[in] pParentBody 00146 * Pointer to the parent rigid body, can be a null pointer 00147 * @param[in] pChildBody 00148 * Pointer to the attached rigid body, can be a null pointer 00149 * @param[in] vPivotPoint 00150 * Origin of the hinge in world space 00151 * @param[in] vPinDir 00152 * The line of action of the hinge in world space 00153 */ 00154 PLPHYSICS_API JointHinge(World &cWorld, JointImpl &cJointImpl, Body *pParentBody, Body *pChildBody, 00155 const PLMath::Vector3 &vPivotPoint, const PLMath::Vector3 &vPinDir); 00156 00157 00158 //[-------------------------------------------------------] 00159 //[ Protected data ] 00160 //[-------------------------------------------------------] 00161 protected: 00162 PLMath::Vector3 m_vPivotPoint; /**< Origin of the hinge in world space */ 00163 PLMath::Vector3 m_vPinDir; /**< The line of action of the hinge in world space */ 00164 00165 00166 //[-------------------------------------------------------] 00167 //[ Private data ] 00168 //[-------------------------------------------------------] 00169 private: 00170 float m_fLowRange; /**< Low range in degree */ 00171 float m_fHighRange; /**< High range in degree */ 00172 00173 00174 }; 00175 00176 00177 //[-------------------------------------------------------] 00178 //[ Namespace ] 00179 //[-------------------------------------------------------] 00180 } // PLPhysics 00181 00182 00183 #endif // __PLPHYSICS_JOINTHINGE_H__
|