PixelLightAPI  .
SceneRenderer.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SceneRenderer.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 __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 events                                         ]
00078     //[-------------------------------------------------------]
00079     public:
00080         PLCore::Event<> EventDestroyed; /**< Scene renderer destroyed event. When this event is emitted the scene renderer is already in the destruction phase and parts may already be invalid. Best to e.g. only update our scene renderer pointer. */
00081 
00082 
00083     //[-------------------------------------------------------]
00084     //[ Public functions                                      ]
00085     //[-------------------------------------------------------]
00086     public:
00087         /**
00088         *  @brief
00089         *    Returns the scene renderer manager this scene renderer is in
00090         *
00091         *  @return
00092         *     The scene renderer manager this shader is in
00093         */
00094         PLS_API SceneRendererManager &GetSceneRendererManager() const;
00095 
00096         /**
00097         *  @brief
00098         *    Creates a new scene renderer pass
00099         *
00100         *  @param[in] sClass
00101         *    Name of the scene renderer pass class to create an instance from
00102         *  @param[in] sName
00103         *    Scene renderer pass name
00104         *  @param[in] sParameters
00105         *    Optional parameter string
00106         *
00107         *  @return
00108         *    Pointer to the new scene renderer pass or a null pointer if something went wrong
00109         *    (maybe unknown class or the class is not derived from SceneRendererPass)
00110         *
00111         *  @note
00112         *    - If the desired name is already in use, the name is chosen automatically
00113         */
00114         PLS_API SceneRendererPass *Create(const PLCore::String &sClass, const PLCore::String &sName = "", const PLCore::String &sParameters = "");
00115 
00116 
00117     //[-------------------------------------------------------]
00118     //[ Protected functions                                   ]
00119     //[-------------------------------------------------------]
00120     protected:
00121         /**
00122         *  @brief
00123         *    Constructor
00124         *
00125         *  @param[in] cManager
00126         *    Scene renderer manager using this resource
00127         *  @param[in] sName
00128         *    Resource name to set
00129         */
00130         PLS_API SceneRenderer(SceneRendererManager &cManager, const PLCore::String &sName);
00131 
00132         /**
00133         *  @brief
00134         *    Destructor
00135         */
00136         PLS_API virtual ~SceneRenderer();
00137 
00138 
00139     //[-------------------------------------------------------]
00140     //[ Private virtual SceneRenderer functions               ]
00141     //[-------------------------------------------------------]
00142     private:
00143         /**
00144         *  @brief
00145         *    Draws the scene using this scene renderer
00146         *
00147         *  @param[in] cRenderer
00148         *    Renderer to use
00149         *  @param[in] cCullQuery
00150         *    Cull scene query to use
00151         */
00152         PLS_API virtual void DrawScene(PLRenderer::Renderer &cRenderer, const SQCull &cCullQuery);
00153 
00154 
00155     //[-------------------------------------------------------]
00156     //[ Public virtual PLCore::Loadable functions             ]
00157     //[-------------------------------------------------------]
00158     public:
00159         PLS_API virtual bool Unload() override;
00160         PLS_API virtual PLCore::String GetLoadableTypeName() const override;
00161 
00162 
00163     //[-------------------------------------------------------]
00164     //[ Private virtual PLCore::ElementManager functions      ]
00165     //[-------------------------------------------------------]
00166     private:
00167         PLS_API virtual SceneRendererPass *CreateElement(const PLCore::String &sName) override;
00168 
00169 
00170 };
00171 
00172 
00173 //[-------------------------------------------------------]
00174 //[ Namespace                                             ]
00175 //[-------------------------------------------------------]
00176 } // PLScene
00177 
00178 
00179 #endif // __PLSCENE_COMPOSITING_SCENERENDERER_H__


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