PixelLightAPI  .
MeshOctree.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: MeshOctree.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 __PLMESH_MESHOCTREE_H__
00024 #define __PLMESH_MESHOCTREE_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLMath/Octree.h>
00032 #include "PLMesh/PLMesh.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Forward declarations                                  ]
00037 //[-------------------------------------------------------]
00038 namespace PLCore {
00039     class Bitset;
00040     template <class AType> class Array;
00041 }
00042 namespace PLGraphics {
00043     class Color4;
00044 }
00045 
00046 
00047 //[-------------------------------------------------------]
00048 //[ Namespace                                             ]
00049 //[-------------------------------------------------------]
00050 namespace PLMesh {
00051 
00052 
00053 //[-------------------------------------------------------]
00054 //[ Classes                                               ]
00055 //[-------------------------------------------------------]
00056 /**
00057 *  @brief
00058 *    Mesh octree
00059 */
00060 class MeshOctree : public PLMath::Octree {
00061 
00062 
00063     //[-------------------------------------------------------]
00064     //[ Public functions                                      ]
00065     //[-------------------------------------------------------]
00066     public:
00067         /**
00068         *  @brief
00069         *    Constructor
00070         */
00071         PLMESH_API MeshOctree();
00072 
00073         /**
00074         *  @brief
00075         *    Destructor
00076         */
00077         PLMESH_API virtual ~MeshOctree();
00078 
00079         /**
00080         *  @brief
00081         *    Builds the octree
00082         *
00083         *  @param[in]  cMeshLODLevel
00084         *    Owner mesh LOD level
00085         *  @param[in]  nNumOfGeometries
00086         *    Number of geometry indices
00087         *  @param[in]  nGeometries
00088         *    Geometry indices
00089         *  @param[out] plstOctreeIDList
00090         *    Will optionally store a list of octrees each geometry is in if not a null pointer
00091         *
00092         *  @return
00093         *    'true' if all went fine, else 'false'
00094         */
00095         PLMESH_API bool Build(MeshLODLevel &cMeshLODLevel, PLCore::uint32 nNumOfGeometries, const PLCore::uint32 nGeometries[],
00096                               PLCore::Array<PLCore::Array<PLCore::uint32>*> *plstOctreeIDList = nullptr);
00097 
00098         /**
00099         *  @brief
00100         *    Draws the octree
00101         *
00102         *  @param[in] cColor
00103         *    Color to use
00104         *  @param[in] mWorldViewProjection
00105         *    World view projection matrix to use
00106         *  @param[in] fLineWidth
00107         *    Line width
00108         */
00109         PLMESH_API void Draw(const PLGraphics::Color4 &cColor, const PLMath::Matrix4x4 &mWorldViewProjection, float fLineWidth = 1.0f) const;
00110 
00111 
00112     //[-------------------------------------------------------]
00113     //[ Private data                                          ]
00114     //[-------------------------------------------------------]
00115     private:
00116         MeshLODLevel   *m_pOwnerMeshLODLevel;   /**< Pointer to the owner, can be a null pointer */
00117         PLCore::uint32  m_nNumOfGeometries;     /**< Number of geometry indices */
00118         PLCore::uint32 *m_pnGeometries;         /**< Geometry indices, can be a null pointer */
00119 
00120 
00121     //[-------------------------------------------------------]
00122     //[ Private virtual PLMath::Octree functions              ]
00123     //[-------------------------------------------------------]
00124     private:
00125         virtual void CustomVisible(PLCore::Bitset *pBitset = nullptr) override;
00126 
00127 
00128 };
00129 
00130 
00131 //[-------------------------------------------------------]
00132 //[ Namespace                                             ]
00133 //[-------------------------------------------------------]
00134 } // PLMesh
00135 
00136 
00137 #endif // __PLMESH_MESHOCTREE_H__


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