PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SceneRenderer.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_COMPOSITING_SCENERENDERER_H__ 00024 #define __PLSCENE_COMPOSITING_SCENERENDERER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Container/Resource.h> 00032 #include "PLScene/Compositing/SceneRendererPass.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLScene { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Forward declarations ] 00043 //[-------------------------------------------------------] 00044 class SceneRendererManager; 00045 00046 00047 //[-------------------------------------------------------] 00048 //[ Classes ] 00049 //[-------------------------------------------------------] 00050 /** 00051 * @brief 00052 * Scene renderer class 00053 * 00054 * @remarks 00055 * A scene renderer 'just' renders the scene visibility tree provided by the scene cull query. (SQCull) 00056 * Quite primitive scene renderers can be implemented completely within one scene renderer class. 00057 * If a lot of special effects and so one are required, we strongly recommend to split up the rendering into 00058 * multiple self-containing rendering passes. Have a look into the 'SceneRendererPass' class documentation 00059 * for more information about this topic. 00060 * 00061 * @note 00062 * - Derived classes should use a 'SR'-prefix (example: SRBegin) 00063 * - Prefer creating new scene renderer passes instead of scene renderer 00064 */ 00065 class SceneRenderer : public PLCore::Resource<SceneRenderer>, public PLCore::ElementManager<SceneRendererPass> { 00066 00067 00068 //[-------------------------------------------------------] 00069 //[ Friends ] 00070 //[-------------------------------------------------------] 00071 friend class SPScene; 00072 friend class SceneRendererManager; 00073 friend class PLCore::ResourceManager<SceneRenderer>; 00074 00075 00076 //[-------------------------------------------------------] 00077 //[ Public functions ] 00078 //[-------------------------------------------------------] 00079 public: 00080 /** 00081 * @brief 00082 * Returns the scene renderer manager this scene renderer is in 00083 * 00084 * @return 00085 * The scene renderer manager this shader is in 00086 */ 00087 PLS_API SceneRendererManager &GetSceneRendererManager() const; 00088 00089 /** 00090 * @brief 00091 * Creates a new scene renderer pass 00092 * 00093 * @param[in] sClass 00094 * Name of the scene renderer pass class to create an instance from 00095 * @param[in] sName 00096 * Scene renderer pass name 00097 * @param[in] sParameters 00098 * Optional parameter string 00099 * 00100 * @return 00101 * Pointer to the new scene renderer pass or a null pointer if something went wrong 00102 * (maybe unknown class or the class is not derived from SceneRendererPass) 00103 * 00104 * @note 00105 * - If the desired name is already in use, the name is chosen automatically 00106 */ 00107 PLS_API SceneRendererPass *Create(const PLCore::String &sClass, const PLCore::String &sName = "", const PLCore::String &sParameters = ""); 00108 00109 00110 //[-------------------------------------------------------] 00111 //[ Protected functions ] 00112 //[-------------------------------------------------------] 00113 protected: 00114 /** 00115 * @brief 00116 * Constructor 00117 * 00118 * @param[in] cManager 00119 * Scene renderer manager using this resource 00120 * @param[in] sName 00121 * Resource name to set 00122 */ 00123 PLS_API SceneRenderer(SceneRendererManager &cManager, const PLCore::String &sName); 00124 00125 /** 00126 * @brief 00127 * Destructor 00128 */ 00129 PLS_API virtual ~SceneRenderer(); 00130 00131 00132 //[-------------------------------------------------------] 00133 //[ Private virtual SceneRenderer functions ] 00134 //[-------------------------------------------------------] 00135 private: 00136 /** 00137 * @brief 00138 * Draws the scene using this scene renderer 00139 * 00140 * @param[in] cRenderer 00141 * Renderer to use 00142 * @param[in] cCullQuery 00143 * Cull scene query to use 00144 */ 00145 PLS_API virtual void DrawScene(PLRenderer::Renderer &cRenderer, const SQCull &cCullQuery); 00146 00147 00148 //[-------------------------------------------------------] 00149 //[ Public virtual PLCore::Loadable functions ] 00150 //[-------------------------------------------------------] 00151 public: 00152 PLS_API virtual bool Unload() override; 00153 PLS_API virtual PLCore::String GetLoadableTypeName() const override; 00154 00155 00156 //[-------------------------------------------------------] 00157 //[ Private virtual PLCore::ElementManager functions ] 00158 //[-------------------------------------------------------] 00159 private: 00160 PLS_API virtual SceneRendererPass *CreateElement(const PLCore::String &sName) override; 00161 00162 00163 }; 00164 00165 00166 //[-------------------------------------------------------] 00167 //[ Namespace ] 00168 //[-------------------------------------------------------] 00169 } // PLScene 00170 00171 00172 #endif // __PLSCENE_COMPOSITING_SCENERENDERER_H__
|