PixelLightAPI  .
Geometry.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Geometry.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 __PLMESH_GEOMETRY_H__
00024 #define __PLMESH_GEOMETRY_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLRenderer/Renderer/Types.h>
00032 #include "PLMesh/PLMesh.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLMesh {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    A geometry defines a part of the index buffer to describe a geometry
00047 */
00048 class Geometry {
00049 
00050 
00051     //[-------------------------------------------------------]
00052     //[ Public functions                                      ]
00053     //[-------------------------------------------------------]
00054     public:
00055         /**
00056         *  @brief
00057         *    Constructor
00058         */
00059         PLMESH_API Geometry();
00060 
00061         /**
00062         *  @brief
00063         *    Destructor
00064         */
00065         PLMESH_API ~Geometry();
00066 
00067         /**
00068         *  @brief
00069         *    Returns the geometrie's name
00070         *
00071         *  @return
00072         *    Name of the geometry
00073         */
00074         PLMESH_API PLCore::String GetName() const;
00075 
00076         /**
00077         *  @brief
00078         *    Sets the geometry name
00079         *
00080         *  @param[in] sName
00081         *    Name of the geometry
00082         */
00083         PLMESH_API void SetName(const PLCore::String &sName = "");
00084 
00085         /**
00086         *  @brief
00087         *    Returns the geometry flags
00088         *
00089         *  @return
00090         *    Geometry flags
00091         */
00092         PLMESH_API PLCore::uint32 GetFlags() const;
00093 
00094         /**
00095         *  @brief
00096         *    Sets the geometry flags
00097         *
00098         *  @param[in] nFlags
00099         *    Geometry flags
00100         */
00101         PLMESH_API void SetFlags(PLCore::uint32 nFlags = 0);
00102 
00103         /**
00104         *  @brief
00105         *    Returns the geometry active flag
00106         *
00107         *  @return
00108         *    'true' if the geometry is active, else 'false'
00109         */
00110         PLMESH_API bool IsActive() const;
00111 
00112         /**
00113         *  @brief
00114         *    Sets the geometry active flag
00115         *
00116         *  @param[in] bActive
00117         *    'true' if the geometry is active, else 'false'
00118         */
00119         PLMESH_API void SetActive(bool bActive = true);
00120 
00121         /**
00122         *  @brief
00123         *    Returns the type of the primitives
00124         *
00125         *  @return
00126         *    Primitive type (e.g. triangles, triangle strips etc.)
00127         */
00128         PLMESH_API PLRenderer::Primitive::Enum GetPrimitiveType() const;
00129 
00130         /**
00131         *  @brief
00132         *    Sets the type of the primitives
00133         *
00134         *  @param[in] nPrimitiveType
00135         *    Primitive type (e.g. triangles, triangle strips etc.)
00136         */
00137         PLMESH_API void SetPrimitiveType(PLRenderer::Primitive::Enum nPrimitiveType = PLRenderer::Primitive::Unknown);
00138 
00139         /**
00140         *  @brief
00141         *    Returns the material used by this geometry
00142         *
00143         *  @return
00144         *    Number of the material that is used
00145         */
00146         PLMESH_API PLCore::uint32 GetMaterial() const;
00147 
00148         /**
00149         *  @brief
00150         *    Sets the material used by this geometry
00151         *
00152         *  @param[in] nMaterial
00153         *    Number of the material that is used
00154         */
00155         PLMESH_API void SetMaterial(PLCore::uint32 nMaterial = 0);
00156 
00157         /**
00158         *  @brief
00159         *    Returns the start index
00160         *
00161         *  @return
00162         *    Start index
00163         */
00164         PLMESH_API PLCore::uint32 GetStartIndex() const;
00165 
00166         /**
00167         *  @brief
00168         *    Sets the start index
00169         *
00170         *  @param[in] nStartIndex
00171         *    Start index
00172         */
00173         PLMESH_API void SetStartIndex(PLCore::uint32 nStartIndex = 0);
00174 
00175         /**
00176         *  @brief
00177         *    Returns the index size
00178         *
00179         *  @return
00180         *    Index size
00181         */
00182         PLMESH_API PLCore::uint32 GetIndexSize() const;
00183 
00184         /**
00185         *  @brief
00186         *    Sets the index size
00187         *
00188         *  @param[in] nIndexSize
00189         *    Index size
00190         */
00191         PLMESH_API void SetIndexSize(PLCore::uint32 nIndexSize = 0);
00192 
00193         /**
00194         *  @brief
00195         *    Returns the number of triangles the geometry consists of
00196         *
00197         *  @return
00198         *    Number of triangles (always 0 if less than 3 indices!)
00199         */
00200         PLMESH_API PLCore::uint32 GetNumOfTriangles() const;
00201 
00202         /**
00203         *  @brief
00204         *    Copy operator
00205         *
00206         *  @param[in] cSource
00207         *    Source to copy from
00208         *
00209         *  @return
00210         *    Reference to this object
00211         */
00212         PLMESH_API Geometry &operator =(const Geometry &cSource);
00213 
00214         /**
00215         *  @brief
00216         *    Compares two geometries
00217         *
00218         *  @param[in] cGeometry
00219         *    Geometry to compare with
00220         *
00221         *  @return
00222         *    'true' if both geometries are equal, else 'false'
00223         */
00224         PLMESH_API bool operator ==(const Geometry &cGeometry) const;
00225 
00226 
00227     //[-------------------------------------------------------]
00228     //[ Private data                                          ]
00229     //[-------------------------------------------------------]
00230     private:
00231         // Geometry description
00232         PLCore::String m_sName;     /**< Name of the geometry */
00233         PLCore::uint32 m_nFlags;    /**< Flags */
00234         bool           m_bActive;   /**< Is this geometry active? */
00235         // Geometry data
00236         PLRenderer::Primitive::Enum  m_nPrimitiveType;  /**< Primitive type */
00237         PLCore::uint32               m_nMaterial;       /**< Material number */
00238         PLCore::uint32               m_nStartIndex;     /**< Start index of index buffer */
00239         PLCore::uint32               m_nIndexSize;      /**< Number of indices */
00240 
00241 
00242 };
00243 
00244 
00245 //[-------------------------------------------------------]
00246 //[ Namespace                                             ]
00247 //[-------------------------------------------------------]
00248 } // PLMesh
00249 
00250 
00251 #endif // __PLMESH_GEOMETRY_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:56
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported