PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNMPhysicsBodyConvexHull.h * 00003 * 00004 * Copyright (C) 2002-2011 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_BODYCONVEXHULL_H__ 00024 #define __PLPHYSICS_SCENENODEMODIFIERS_BODYCONVEXHULL_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLPhysics/SceneNodeModifiers/SNMPhysicsBody.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLPhysics { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Classes ] 00042 //[-------------------------------------------------------] 00043 /** 00044 * @brief 00045 * Physics convex hull body scene node modifier 00046 * 00047 * @remarks 00048 * Convex hulls are the solution to collision primitive that can not be easily represented 00049 * by and implicit solid. The implicit solid primitives (spheres, cubes, cylinders, capsules, 00050 * cones, etc.), have constant time complexity for contact calculation and are also extremely 00051 * efficient on memory usage, therefore the application get perfect smooth behavior. However 00052 * for cases where the shape is too difficult or a polygonal representation is desired convex 00053 * hulls are the ultimate solution. For example it is a mistake to model a 10000 point sphere 00054 * as a convex hull, when the perfect sphere is available.\n 00055 * There is not upper limit as to how many vertices the application can pass to make 00056 * a hull shape, however for performance and memory usage concern it is the application 00057 * responsibility to keep the max vertex at the possible minimum. The minimum number of vertices 00058 * should be equal or larger than 4 and it is the application responsibility that the points are 00059 * part of a solid geometry. Unpredictable results will occur if all points happen to be collinear 00060 * or coplanar. 00061 */ 00062 class SNMPhysicsBodyConvexHull : public SNMPhysicsBody { 00063 00064 00065 //[-------------------------------------------------------] 00066 //[ RTTI interface ] 00067 //[-------------------------------------------------------] 00068 pl_class(PLPHYSICS_RTTI_EXPORT, SNMPhysicsBodyConvexHull, "PLPhysics", PLPhysics::SNMPhysicsBody, "Physics convex hull body scene node modifier") 00069 // Attributes 00070 pl_attribute(Mesh, PLCore::String, "", ReadWrite, GetSet, "Collision mesh, if empty, the variable 'Mesh' (if available) of the scene node is used instead", "Type='Mesh'") 00071 // Constructors 00072 pl_constructor_1(ParameterConstructor, PLScene::SceneNode&, "Parameter constructor", "") 00073 pl_class_end 00074 00075 00076 //[-------------------------------------------------------] 00077 //[ Public RTTI get/set functions ] 00078 //[-------------------------------------------------------] 00079 public: 00080 PLPHYSICS_API PLCore::String GetMesh() const; 00081 PLPHYSICS_API void SetMesh(const PLCore::String &sValue); 00082 00083 00084 //[-------------------------------------------------------] 00085 //[ Public functions ] 00086 //[-------------------------------------------------------] 00087 public: 00088 /** 00089 * @brief 00090 * Constructor 00091 * 00092 * @param[in] cSceneNode 00093 * Owner scene node 00094 */ 00095 PLPHYSICS_API SNMPhysicsBodyConvexHull(PLScene::SceneNode &cSceneNode); 00096 00097 /** 00098 * @brief 00099 * Destructor 00100 */ 00101 PLPHYSICS_API virtual ~SNMPhysicsBodyConvexHull(); 00102 00103 00104 //[-------------------------------------------------------] 00105 //[ Private data ] 00106 //[-------------------------------------------------------] 00107 private: 00108 PLCore::String m_sMesh; /**< Collision mesh, if empty, the variable 'Mesh' (if available) of the scene node is used instead */ 00109 00110 00111 //[-------------------------------------------------------] 00112 //[ Private virtual SNMPhysicsBody functions ] 00113 //[-------------------------------------------------------] 00114 private: 00115 virtual void CreatePhysicsBody() override; 00116 00117 00118 }; 00119 00120 00121 //[-------------------------------------------------------] 00122 //[ Namespace ] 00123 //[-------------------------------------------------------] 00124 } // PLPhysics 00125 00126 00127 #endif // __PLPHYSICS_SCENENODEMODIFIERS_BODYCONVEXHULL_H__
|