PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNTerrain.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 __PLSCENE_SCENENODE_TERRAIN_H__ 00024 #define __PLSCENE_SCENENODE_TERRAIN_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Tools/Loadable.h> 00032 #include "PLScene/Scene/SceneNode.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Forward declarations ] 00037 //[-------------------------------------------------------] 00038 namespace PLGraphics { 00039 class Image; 00040 } 00041 namespace PLScene { 00042 class GMMSurface; 00043 } 00044 00045 00046 //[-------------------------------------------------------] 00047 //[ Namespace ] 00048 //[-------------------------------------------------------] 00049 namespace PLScene { 00050 00051 00052 //[-------------------------------------------------------] 00053 //[ Classes ] 00054 //[-------------------------------------------------------] 00055 /** 00056 * @brief 00057 * Terrain scene node 00058 */ 00059 class SNTerrain : public SceneNode, public PLCore::Loadable { 00060 00061 00062 //[-------------------------------------------------------] 00063 //[ Friends ] 00064 //[-------------------------------------------------------] 00065 // [TODO] Add additional functions to the interface and remove this 00066 friend class TerrainLoaderPL; 00067 00068 00069 //[-------------------------------------------------------] 00070 //[ RTTI interface ] 00071 //[-------------------------------------------------------] 00072 pl_class(PLS_RTTI_EXPORT, SNTerrain, "PLScene", PLScene::SceneNode, "Terrain scene node") 00073 // Attributes 00074 pl_attribute(Filename, PLCore::String, "", ReadWrite, GetSet, "Terrain filename", "Type='Terrain'") 00075 // Constructors 00076 pl_constructor_0(DefaultConstructor, "Default constructor", "") 00077 pl_class_end 00078 00079 00080 //[-------------------------------------------------------] 00081 //[ Public RTTI get/set functions ] 00082 //[-------------------------------------------------------] 00083 public: 00084 PLS_API PLCore::String GetFilename() const; 00085 PLS_API void SetFilename(const PLCore::String &sValue); 00086 00087 00088 //[-------------------------------------------------------] 00089 //[ Public functions ] 00090 //[-------------------------------------------------------] 00091 public: 00092 /** 00093 * @brief 00094 * Default constructor 00095 */ 00096 PLS_API SNTerrain(); 00097 00098 /** 00099 * @brief 00100 * Destructor 00101 */ 00102 PLS_API virtual ~SNTerrain(); 00103 00104 /** 00105 * @brief 00106 * Returns the GMM surface 00107 * 00108 * @return 00109 * The terrain GMM surface, can be a null pointer 00110 */ 00111 PLS_API GMMSurface *GetGMMSurface() const; 00112 00113 00114 //[-------------------------------------------------------] 00115 //[ Private functions ] 00116 //[-------------------------------------------------------] 00117 private: 00118 /** 00119 * @brief 00120 * Loads the height map 00121 * 00122 * @param[in] sHeightMap 00123 * Filename of the height map to load 00124 * @param[out] cHeightMap 00125 * Receives the loaded height map 00126 * 00127 * @return 00128 * 'true' if all went fine, else 'false' 00129 */ 00130 bool LoadHeightMap(const PLCore::String &sHeightMap, PLGraphics::Image &cHeightMap); 00131 00132 00133 //[-------------------------------------------------------] 00134 //[ Private data ] 00135 //[-------------------------------------------------------] 00136 private: 00137 PLCore::String m_sFilename; /**< Terrain filename */ 00138 float *m_pfHeightMap; /**< Height map, can be a null pointer */ 00139 GMMSurface *m_pGMMSurface; /**< Terrain GMM surface, can be a null pointer */ 00140 00141 00142 //[-------------------------------------------------------] 00143 //[ Public virtual SceneNode functions ] 00144 //[-------------------------------------------------------] 00145 public: 00146 PLS_API virtual void DrawSolid(PLRenderer::Renderer &cRenderer, const VisNode *pVisNode = nullptr) override; 00147 00148 00149 //[-------------------------------------------------------] 00150 //[ Private virtual SceneNode functions ] 00151 //[-------------------------------------------------------] 00152 private: 00153 virtual void InitFunction() override; 00154 00155 00156 //[-------------------------------------------------------] 00157 //[ Public virtual PLCore::Loadable functions ] 00158 //[-------------------------------------------------------] 00159 public: 00160 PLS_API virtual bool Unload() override; 00161 PLS_API virtual PLCore::String GetLoadableTypeName() const override; 00162 00163 00164 //[-------------------------------------------------------] 00165 //[ Private virtual PLCore::Loadable functions ] 00166 //[-------------------------------------------------------] 00167 private: 00168 virtual bool CallLoadable(PLCore::File &cFile, PLCore::Loader &cLoader, const PLCore::String &sMethod, const PLCore::String &sParams) override; 00169 00170 00171 }; 00172 00173 00174 //[-------------------------------------------------------] 00175 //[ Namespace ] 00176 //[-------------------------------------------------------] 00177 } // PLScene 00178 00179 00180 #endif // __PLSCENE_SCENENODE_TERRAIN_H__
|