PixelLightAPI  .
BodyConvexHull.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: BodyConvexHull.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_BODYCONVEXHULL_H__
00024 #define __PLPHYSICS_BODYCONVEXHULL_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLMath/Vector3.h>
00032 #include "PLPhysics/Body.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLPhysics {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    Abstract PL physics convex hull body
00047 *
00048 *  @remarks
00049 *    Convex hulls are the solution to collision primitive that can not be easily represented
00050 *    by and implicit solid. The implicit solid primitives (spheres, cubes, cylinders, capsules,
00051 *    cones, etc.), have constant time complexity for contact calculation and are also extremely
00052 *    efficient on memory usage, therefore the application get perfect smooth behavior. However
00053 *    for cases where the shape is too difficult or a polygonal representation is desired convex
00054 *    hulls are the ultimate solution. For example it is a mistake to model a 10000 point sphere
00055 *    as a convex hull, when the perfect sphere is available.\n
00056 *    There is not upper limit as to how many vertices the application can pass to make
00057 *    a hull shape, however for performance and memory usage concern it is the application
00058 *    responsibility to keep the max vertex at the possible minimum. The minimum number of vertices
00059 *    should be equal or larger than 4 and it is the application responsibility that the points are
00060 *    part of a solid geometry. Unpredictable results will occur if all points happen to be collinear
00061 *    or coplanar.
00062 */
00063 class BodyConvexHull : public Body {
00064 
00065 
00066     //[-------------------------------------------------------]
00067     //[ Public functions                                      ]
00068     //[-------------------------------------------------------]
00069     public:
00070         /**
00071         *  @brief
00072         *    Destructor
00073         */
00074         PLPHYSICS_API virtual ~BodyConvexHull();
00075 
00076         /**
00077         *  @brief
00078         *    Returns the collision mesh
00079         *
00080         *  @return
00081         *    The collision mesh
00082         */
00083         PLPHYSICS_API PLCore::String GetMesh() const;
00084 
00085         /**
00086         *  @brief
00087         *    Returns the mesh scale
00088         *
00089         *  @return
00090         *    The mesh scale
00091         */
00092         PLPHYSICS_API const PLMath::Vector3 &GetMeshScale() const;
00093 
00094 
00095     //[-------------------------------------------------------]
00096     //[ Protected functions                                   ]
00097     //[-------------------------------------------------------]
00098     protected:
00099         /**
00100         *  @brief
00101         *    Constructor
00102         *
00103         *  @param[in] cWorld
00104         *    World this body is in
00105         *  @param[in] cBodyImpl
00106         *    Reference to the physics API specific body implementation
00107         *  @param[in] sMesh
00108         *    Collision mesh
00109         *  @param[in] vMeshScale
00110         *    Mesh scale
00111         */
00112         PLPHYSICS_API BodyConvexHull(World &cWorld, BodyImpl &cBodyImpl, const PLCore::String &sMesh, const PLMath::Vector3 &vMeshScale);
00113 
00114 
00115     //[-------------------------------------------------------]
00116     //[ Protected data                                        ]
00117     //[-------------------------------------------------------]
00118     protected:
00119         PLCore::String  m_sMesh;        /**< Collision mesh */
00120         PLMath::Vector3 m_vMeshScale;   /**< Mesh scale */
00121 
00122 
00123 };
00124 
00125 
00126 //[-------------------------------------------------------]
00127 //[ Namespace                                             ]
00128 //[-------------------------------------------------------]
00129 } // PLPhysics
00130 
00131 
00132 #endif // __PLPHYSICS_BODYCONVEXHULL_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:51
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported