PixelLightAPI  .
SceneRendererPass.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SceneRendererPass.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_SCENERENDERERPASS_H__
00024 #define __PLSCENE_COMPOSITING_SCENERENDERERPASS_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Base/Object.h>
00032 #include <PLCore/Container/Element.h>
00033 #include <PLCore/Container/ElementHandler.h>
00034 #include <PLCore/Container/ElementManager.h>
00035 #include "PLScene/PLScene.h"
00036 
00037 
00038 //[-------------------------------------------------------]
00039 //[ Forward declarations                                  ]
00040 //[-------------------------------------------------------]
00041 namespace PLRenderer {
00042     class Renderer;
00043 }
00044 namespace PLScene {
00045     class SQCull;
00046     class SceneContext;
00047 }
00048 
00049 
00050 //[-------------------------------------------------------]
00051 //[ Namespace                                             ]
00052 //[-------------------------------------------------------]
00053 namespace PLScene {
00054 
00055 
00056 //[-------------------------------------------------------]
00057 //[ Classes                                               ]
00058 //[-------------------------------------------------------]
00059 /**
00060 *  @brief
00061 *    Abstract scene renderer pass class
00062 *
00063 *  @remarks
00064 *    Usually, the rendering of complex scenes can be split up into smaller, self-containing steps.
00065 *    (one hand does not need to know what the other is doing :)
00066 *    One step/pass will just draw the scene without any lighting or special effects. Another may
00067 *    'draw over' the result for each light in the scene while special steps may only draw some
00068 *    debug information like icons, wireframes and so on. By solve the rendering in such passes,
00069 *    implementing new features, combining existing ones etc. is much easier as if your scene renderer
00070 *    only consists of one bit piece of code - and scene renderers can get REALLY extensive!
00071 *    In short, you can imagine 'scene renderer passes' as 'subsystems' of a scene renderer.
00072 *
00073 *  @note
00074 *    - Derived classes should use a 'SRP' prefix (example: SRPBegin)
00075 */
00076 class SceneRendererPass : public PLCore::Object, public PLCore::Element<SceneRendererPass> {
00077 
00078 
00079     //[-------------------------------------------------------]
00080     //[ Friends                                               ]
00081     //[-------------------------------------------------------]
00082     friend class SceneRenderer;
00083 
00084 
00085     //[-------------------------------------------------------]
00086     //[ Public definition                                     ]
00087     //[-------------------------------------------------------]
00088     public:
00089         /**
00090         *  @brief
00091         *    Scene renderer pass flags
00092         */
00093         enum EFlags {
00094             Inactive = 1<<0 /**< This scene renderer pass is currently NOT active */
00095         };
00096         pl_enum(EFlags)
00097             pl_enum_value(Inactive, "This scene renderer pass is currently NOT active")
00098         pl_enum_end
00099 
00100 
00101     //[-------------------------------------------------------]
00102     //[ RTTI interface                                        ]
00103     //[-------------------------------------------------------]
00104     pl_class(PLS_RTTI_EXPORT, SceneRendererPass, "PLScene", PLCore::Object, "Abstract scene renderer pass class")
00105         // Attributes
00106         pl_attribute(Flags, pl_flag_type(EFlags),   0,  ReadWrite,  GetSet, "Flags",                                                                                "")
00107         pl_attribute(Name,  PLCore::String,         "", ReadWrite,  GetSet, "Optional scene renderer pass name. If not defined, a name is chosen automatically",    "")
00108     pl_class_end
00109 
00110 
00111     //[-------------------------------------------------------]
00112     //[ Public RTTI get/set functions                         ]
00113     //[-------------------------------------------------------]
00114     public:
00115         PLS_API virtual PLCore::uint32 GetFlags() const;
00116         PLS_API virtual void SetFlags(PLCore::uint32 nValue);
00117 
00118 
00119     //[-------------------------------------------------------]
00120     //[ Public functions                                      ]
00121     //[-------------------------------------------------------]
00122     public:
00123         /**
00124         *  @brief
00125         *    Returns the scene context the scene renderer pass is in
00126         *
00127         *  @return
00128         *    The scene context the scene renderer pass is in, can but shouldn't be a null pointer
00129         */
00130         PLS_API SceneContext *GetSceneContext() const;
00131 
00132         /**
00133         *  @brief
00134         *    Returns the used renderer
00135         *
00136         *  @return
00137         *    The used renderer, can but shouldn't be a null pointer
00138         */
00139         PLS_API PLRenderer::Renderer *GetRenderer() const;
00140 
00141         /**
00142         *  @brief
00143         *    Returns the first found instance of a scene renderer pass instance within the scene renderer by using a class name
00144         *
00145         *  @param[in] sClassName
00146         *    Class name of the scene renderer pass instance
00147         *
00148         *  @return
00149         *    The first found instance of a scene renderer pass instance within the scene renderer, can be a null pointer
00150         */
00151         PLS_API SceneRendererPass *GetFirstInstanceOfSceneRendererPassClass(const PLCore::String &sClassName) const;
00152 
00153         /**
00154         *  @brief
00155         *    Is the scene renderer pass active?
00156         *
00157         *  @return
00158         *    'true' if the scene renderer pass is active, else 'false'
00159         */
00160         PLS_API bool IsActive() const;
00161 
00162         /**
00163         *  @brief
00164         *    Sets whether the scene renderer pass is active or not
00165         *
00166         *  @param[in] bActive
00167         *    Should the scene renderer pass be active?
00168         *
00169         *  @note
00170         *    - Sets/unsets the 'Inactive'-flag
00171         */
00172         PLS_API void SetActive(bool bActive = true);
00173 
00174 
00175     //[-------------------------------------------------------]
00176     //[ Protected functions                                   ]
00177     //[-------------------------------------------------------]
00178     protected:
00179         /**
00180         *  @brief
00181         *    Constructor
00182         */
00183         PLS_API SceneRendererPass();
00184 
00185         /**
00186         *  @brief
00187         *    Destructor
00188         */
00189         PLS_API virtual ~SceneRendererPass();
00190 
00191 
00192     //[-------------------------------------------------------]
00193     //[ Private virtual SceneRendererPass functions           ]
00194     //[-------------------------------------------------------]
00195     private:
00196         /**
00197         *  @brief
00198         *    Draws the pass
00199         *
00200         *  @param[in] cRenderer
00201         *    Renderer to use
00202         *  @param[in] cCullQuery
00203         *    Cull query to use
00204         */
00205         virtual void Draw(PLRenderer::Renderer &cRenderer, const SQCull &cCullQuery) = 0;
00206 
00207 
00208     //[-------------------------------------------------------]
00209     //[ Private data                                          ]
00210     //[-------------------------------------------------------]
00211     private:
00212         PLCore::uint32 m_nFlags;    /**< Flags */
00213 
00214 
00215 };
00216 
00217 
00218 //[-------------------------------------------------------]
00219 //[ Namespace                                             ]
00220 //[-------------------------------------------------------]
00221 } // PLScene
00222 
00223 
00224 #endif // __PLSCENE_COMPOSITING_SCENERENDERERPASS_H__


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