PixelLightAPI  .
SNEngineInformation.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNEngineInformation.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 __PLENGINE_COMPOSITING_ENGINEINFORMATION_H__
00024 #define __PLENGINE_COMPOSITING_ENGINEINFORMATION_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLScene/Scene/SceneNode.h>
00032 #include "PLEngine/PLEngine.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Forward declarations                                  ]
00037 //[-------------------------------------------------------]
00038 namespace PLRenderer {
00039     class MaterialHandler;
00040 }
00041 
00042 
00043 //[-------------------------------------------------------]
00044 //[ Namespace                                             ]
00045 //[-------------------------------------------------------]
00046 namespace PLEngine {
00047 
00048 
00049 //[-------------------------------------------------------]
00050 //[ Classes                                               ]
00051 //[-------------------------------------------------------]
00052 /**
00053 *  @brief
00054 *    Engine information scene node
00055 *
00056 *  @remarks
00057 *    This scene node can draw different engine/debug information.
00058 *    The drawn depends on the config group 'EngineDebugConfig':
00059 *    ShowFPS, ShowCoordinateAxis, ShowXZPlane, ShowXYPlane, ShowYZPlane
00060 *
00061 *  @note
00062 *    - Should only be used within a scene root container
00063 *    - If profiling is active, you can use the page-up/page-down keys to select the
00064 *      next/previous group
00065 */
00066 class SNEngineInformation : public PLScene::SceneNode {
00067 
00068 
00069     //[-------------------------------------------------------]
00070     //[ Public definitions                                    ]
00071     //[-------------------------------------------------------]
00072     public:
00073         /**
00074         *  @brief
00075         *    Information flags
00076         */
00077         enum EInfoFlags {
00078             FPS            = 1<<0,  /**< Draw FPS */
00079             CoordinateAxis = 1<<1,  /**< Draw coordinate axis */
00080             Planes         = 1<<2,  /**< Draw planes */
00081             Profiling      = 1<<3   /**< Draw profiling */
00082         };
00083         pl_enum(EInfoFlags)
00084             pl_enum_value(FPS,              "Draw FPS")
00085             pl_enum_value(CoordinateAxis,   "Draw coordinate axis")
00086             pl_enum_value(Planes,           "Draw planes")
00087             pl_enum_value(Profiling,        "Draw profiling")
00088         pl_enum_end
00089 
00090 
00091     //[-------------------------------------------------------]
00092     //[ RTTI interface                                        ]
00093     //[-------------------------------------------------------]
00094     pl_class(PL_RTTI_EXPORT, SNEngineInformation, "PLEngine", PLScene::SceneNode, "Engine information scene node")
00095         // Attributes
00096         pl_attribute(InfoFlags,         pl_flag_type(EInfoFlags),   FPS|CoordinateAxis|Planes|Profiling,    ReadWrite,  DirectValue,    "Information flags",    "")
00097         pl_attribute(ProfilingMaterial, PLCore::String,             "Data/Effects/PLProfiling.plfx",        ReadWrite,  GetSet,         "Profiling material",   "Type='Material Effect Image TextureAni'")
00098             // Overwritten SceneNode attributes
00099         pl_attribute(Flags,             pl_flag_type(EFlags),       NoCulling,                              ReadWrite,  GetSet,         "Flags",                "")
00100         // Constructors
00101         pl_constructor_0(DefaultConstructor,    "Default constructor",  "")
00102     pl_class_end
00103 
00104 
00105     //[-------------------------------------------------------]
00106     //[ Public RTTI get/set functions                         ]
00107     //[-------------------------------------------------------]
00108     public:
00109         PL_API PLCore::String GetProfilingMaterial() const;
00110         PL_API void SetProfilingMaterial(const PLCore::String &sValue);
00111 
00112 
00113     //[-------------------------------------------------------]
00114     //[ Public functions                                      ]
00115     //[-------------------------------------------------------]
00116     public:
00117         /**
00118         *  @brief
00119         *    Constructor
00120         */
00121         PL_API SNEngineInformation();
00122 
00123         /**
00124         *  @brief
00125         *    Destructor
00126         */
00127         PL_API virtual ~SNEngineInformation();
00128 
00129         /**
00130         *  @brief
00131         *    Returns the handler of the profiling material
00132         *
00133         *  @return
00134         *    Handler of the profiling material
00135         */
00136         PL_API const PLRenderer::MaterialHandler &GetProfilingMaterialHandler();
00137 
00138 
00139     //[-------------------------------------------------------]
00140     //[ Private functions                                     ]
00141     //[-------------------------------------------------------]
00142     private:
00143         /**
00144         *  @brief
00145         *    Draws the information of the current selected profile group
00146         *
00147         *  @param[in] cRenderer
00148         *    The used renderer
00149         */
00150         void DrawProfiling(PLRenderer::Renderer &cRenderer);
00151 
00152         /**
00153         *  @brief
00154         *    Called when the scene node needs to be updated
00155         */
00156         void OnUpdate();
00157 
00158 
00159     //[-------------------------------------------------------]
00160     //[ Private event handlers                                ]
00161     //[-------------------------------------------------------]
00162     private:
00163         PLCore::EventHandler<> EventHandlerUpdate;
00164 
00165 
00166     //[-------------------------------------------------------]
00167     //[ Private data                                          ]
00168     //[-------------------------------------------------------]
00169     private:
00170         PLCore::String               m_sProfilingMaterial;  /**< Profiling material */
00171         bool                         m_bProfilingMaterial;  /**< Profiling material loaded? */
00172         PLRenderer::MaterialHandler *m_pProfilingMaterial;  /**< Profiling material (ALWAYS valid!) */
00173 
00174 
00175     //[-------------------------------------------------------]
00176     //[ Public virtual PLScene::SceneNode functions           ]
00177     //[-------------------------------------------------------]
00178     public:
00179         PL_API virtual void DrawPost(PLRenderer::Renderer &cRenderer, const PLScene::VisNode *pVisNode = nullptr) override;
00180 
00181 
00182     //[-------------------------------------------------------]
00183     //[ Protected virtual PLScene::SceneNode functions        ]
00184     //[-------------------------------------------------------]
00185     protected:
00186         PL_API virtual void OnActivate(bool bActivate) override;
00187 
00188 
00189 };
00190 
00191 
00192 //[-------------------------------------------------------]
00193 //[ Namespace                                             ]
00194 //[-------------------------------------------------------]
00195 } // PLEngine
00196 
00197 
00198 #endif // __PLENGINE_COMPOSITING_ENGINEINFORMATION_H__


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