PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNMPhysicsBodySphere.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_BODYSPHERE_H__ 00024 #define __PLPHYSICS_SCENENODEMODIFIERS_BODYSPHERE_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLPhysics/SceneNodeModifiers/SNMPhysicsBody.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Forward declarations ] 00036 //[-------------------------------------------------------] 00037 namespace PLRenderer { 00038 class Renderer; 00039 } 00040 namespace PLScene { 00041 class VisNode; 00042 } 00043 00044 00045 //[-------------------------------------------------------] 00046 //[ Namespace ] 00047 //[-------------------------------------------------------] 00048 namespace PLPhysics { 00049 00050 00051 //[-------------------------------------------------------] 00052 //[ Classes ] 00053 //[-------------------------------------------------------] 00054 /** 00055 * @brief 00056 * Physics sphere body scene node modifier 00057 * 00058 * @remarks 00059 * Sphere collision are generalized ellipsoids, the application can create many different kind 00060 * of objects by just playing with dimensions of the radius. For example to make a sphere set all 00061 * tree radius to the same value, to make a ellipse of revolution just set two of the tree radius 00062 * to the same value.\n 00063 * General ellipsoids are very good hull geometries to represent the outer shell of avatars in a game. 00064 */ 00065 class SNMPhysicsBodySphere : public SNMPhysicsBody { 00066 00067 00068 //[-------------------------------------------------------] 00069 //[ RTTI interface ] 00070 //[-------------------------------------------------------] 00071 pl_class(PLPHYSICS_RTTI_EXPORT, SNMPhysicsBodySphere, "PLPhysics", PLPhysics::SNMPhysicsBody, "Physics sphere body scene node modifier") 00072 // Attributes 00073 pl_attribute(Radius, float, 0.0f, ReadWrite, GetSet, "Sphere radius, if null, a sphere 'inside' the axis align bounding box in 'scene node space' is used as default", "Min='0.0'") 00074 // Constructors 00075 pl_constructor_1(ParameterConstructor, PLScene::SceneNode&, "Parameter constructor", "") 00076 // Slots 00077 pl_slot_2(OnDrawDebug, PLRenderer::Renderer&, const PLScene::VisNode*, "Called on scene node debug draw, the used renderer as first parameter, the current visibility node of this scene node as second parameter (can be a null pointer)", "") 00078 pl_class_end 00079 00080 00081 //[-------------------------------------------------------] 00082 //[ Public RTTI get/set functions ] 00083 //[-------------------------------------------------------] 00084 public: 00085 PLPHYSICS_API float GetRadius() const; 00086 PLPHYSICS_API void SetRadius(float fValue); 00087 00088 00089 //[-------------------------------------------------------] 00090 //[ Public functions ] 00091 //[-------------------------------------------------------] 00092 public: 00093 /** 00094 * @brief 00095 * Constructor 00096 * 00097 * @param[in] cSceneNode 00098 * Owner scene node 00099 */ 00100 PLPHYSICS_API SNMPhysicsBodySphere(PLScene::SceneNode &cSceneNode); 00101 00102 /** 00103 * @brief 00104 * Destructor 00105 */ 00106 PLPHYSICS_API virtual ~SNMPhysicsBodySphere(); 00107 00108 00109 //[-------------------------------------------------------] 00110 //[ Private functions ] 00111 //[-------------------------------------------------------] 00112 private: 00113 /** 00114 * @brief 00115 * Called on scene node debug draw 00116 * 00117 * @param[in] cRenderer 00118 * The used renderer 00119 * @param[in] pVisNode 00120 * The current visibility node of this scene node, can be a null pointer 00121 */ 00122 void OnDrawDebug(PLRenderer::Renderer &cRenderer, const PLScene::VisNode *pVisNode); 00123 00124 00125 //[-------------------------------------------------------] 00126 //[ Private data ] 00127 //[-------------------------------------------------------] 00128 private: 00129 float m_fRadius; /**< Sphere radius, if null, a sphere 'inside' the axis align bounding box in 'scene node space' is used as default */ 00130 00131 00132 //[-------------------------------------------------------] 00133 //[ Private virtual PLScene::SceneNodeModifier functions ] 00134 //[-------------------------------------------------------] 00135 private: 00136 virtual void OnActivate(bool bActivate) override; 00137 00138 00139 //[-------------------------------------------------------] 00140 //[ Private virtual SNMPhysicsBody functions ] 00141 //[-------------------------------------------------------] 00142 private: 00143 virtual void CreatePhysicsBody() override; 00144 00145 00146 }; 00147 00148 00149 //[-------------------------------------------------------] 00150 //[ Namespace ] 00151 //[-------------------------------------------------------] 00152 } // PLPhysics 00153 00154 00155 #endif // __PLPHYSICS_SCENENODEMODIFIERS_BODYSPHERE_H__
|