PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: MaterialManager.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 __PLRENDERER_MATERIAL_MANAGER_H__ 00024 #define __PLRENDERER_MATERIAL_MANAGER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Container/ResourceManager.h> 00032 #include "PLRenderer/Material/Material.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLRenderer { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Forward declarations ] 00043 //[-------------------------------------------------------] 00044 class RendererContext; 00045 00046 00047 //[-------------------------------------------------------] 00048 //[ Classes ] 00049 //[-------------------------------------------------------] 00050 /** 00051 * @brief 00052 * This is a manager for the material resource 00053 * 00054 * @note 00055 * - Unloads unused resources automatically by default 00056 */ 00057 class MaterialManager : public PLCore::ResourceManager<Material> { 00058 00059 00060 //[-------------------------------------------------------] 00061 //[ Friends ] 00062 //[-------------------------------------------------------] 00063 friend class RendererContext; 00064 00065 00066 //[-------------------------------------------------------] 00067 //[ Public functions ] 00068 //[-------------------------------------------------------] 00069 public: 00070 /** 00071 * @brief 00072 * Returns the owner renderer context of this manager 00073 * 00074 * @return 00075 * Reference to the owner renderer context of this manager 00076 */ 00077 inline RendererContext &GetRendererContext() const; 00078 00079 /** 00080 * @brief 00081 * Reloads all materials 00082 * 00083 * @return 00084 * 'true' if all went fine, else 'false' 00085 */ 00086 PLRENDERER_API bool ReloadMaterials(); 00087 00088 00089 //[-------------------------------------------------------] 00090 //[ Private functions ] 00091 //[-------------------------------------------------------] 00092 private: 00093 /** 00094 * @brief 00095 * Constructor 00096 * 00097 * @param[in] cRendererContext 00098 * Owner renderer context 00099 */ 00100 MaterialManager(RendererContext &cRendererContext); 00101 00102 /** 00103 * @brief 00104 * Destructor 00105 */ 00106 virtual ~MaterialManager(); 00107 00108 00109 //[-------------------------------------------------------] 00110 //[ Private data ] 00111 //[-------------------------------------------------------] 00112 private: 00113 RendererContext *m_pRendererContext; /**< Owner renderer context of this manager, always valid! */ 00114 00115 00116 //[-------------------------------------------------------] 00117 //[ Private virtual PLCore::ResourceManager functions ] 00118 //[-------------------------------------------------------] 00119 private: 00120 virtual Material *CreateResource(const PLCore::String &sName) override; 00121 00122 00123 }; 00124 00125 00126 //[-------------------------------------------------------] 00127 //[ Namespace ] 00128 //[-------------------------------------------------------] 00129 } // PLRenderer 00130 00131 00132 //[-------------------------------------------------------] 00133 //[ Implementation ] 00134 //[-------------------------------------------------------] 00135 #include "PLRenderer/Material/MaterialManager.inl" 00136 00137 00138 #endif // __PLRENDERER_MATERIAL_MANAGER_H__
|