PixelLightAPI  .
Public Member Functions | Protected Member Functions | Protected Attributes
PLEngine::EngineApplication Class Reference

Basic scene application class. More...

#include <EngineApplication.h>

Inheritance diagram for PLEngine::EngineApplication:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PL_API EngineApplication (PLCore::Frontend &cFrontend, const PLCore::String &sSceneFilename="")
 Constructor.
virtual PL_API ~EngineApplication ()
 Destructor.
PL_API PLScene::SceneContainerGetScene () const
 Returns the scene container (the 'concrete scene')
PL_API void SetScene (PLScene::SceneContainer *pContainer)
 Sets the scene container (the 'concrete scene')
PL_API void ClearScene ()
 Clears the scene, after calling this method the scene is empty.
PL_API PLScene::SNCameraGetCamera () const
 Get scene camera.
PL_API PLInput::VirtualControllerGetInputController () const
 Get virtual input controller.
PL_API void SetInputController (PLInput::VirtualController *pInputController)
 Set virtual input controller.
PL_API SceneRendererToolGetSceneRendererTool ()
 Get scene renderer tool.
PL_API const SceneRendererToolGetSceneRendererTool () const
 Get scene renderer tool.
PL_API ScreenshotGetScreenshotTool ()
 Get screenshot tool.
PL_API bool IsEditModeEnabled () const
 Returns whether or not edit mode is enabled.
PL_API void SetEditModeEnabled (bool bEnabled=true)
 Sets whether or not edit mode is enabled.
PL_API void ConsoleCommandQuit (ConsoleCommand &cCommand)
 Quit the engine.
virtual PL_API void SetCamera (PLScene::SNCamera *pCamera)
 Sets the scene camera.
virtual PL_API bool LoadScene (const PLCore::String &sFilename)
 Loads a scene.

Protected Member Functions

virtual PL_API bool OnStart () override
 Initialization function that is called prior to OnInit()
virtual PL_API void OnResume () override
 Called when the object has the focus (keep the implementation lightweight)
virtual PL_API void OnPause () override
 Called when the object has no longer the focus (keep the implementation lightweight)
virtual PL_API void OnStop () override
 De-initialization function that is called after OnDeInit()
virtual PL_API void OnUpdate () override
 Called to let the frontend update it's states.
virtual PL_API void OnCreateRootScene () override
 Function that is called to create the application's root scene.
virtual PL_API void OnCreateScene (PLScene::SceneContainer &cContainer)
 Function that is called to create the application's scene container.
virtual PL_API void OnCreateInputController ()
 Function that is called to initialize the application's virtual input controller.
virtual PL_API void OnInputControllerFound (PLInput::Controller *pInputController, PLCore::String sInputSemantic)
 Function that is called when an input controller has been found.

Protected Attributes

PLScene::SceneNodeHandler m_cSceneContainerHandler
PLScene::SceneNodeHandler m_cCameraHandler
PLCore::String m_sDefaultSceneRenderer
PLCore::String m_sClearColor
PLCore::String m_sStartCamera
PLScene::SceneNodem_pFirstFoundCamera
PLCore::Array< const
PLScene::SNKeyValue * > 
m_lstPostKeys
bool m_bHasLoadScreen
PLInput::VirtualControllerm_pInputController
SceneRendererTool m_cSceneRendererTool
Screenshot m_cScreenshot
bool m_bEditModeEnabled

Detailed Description

Basic scene application class.

Remarks:
An application class that provides a standard scene graph for usual 3D applications and offers functionality to load in whole scenes at once as well as load screen handling and screenshot capturing.

Constructor & Destructor Documentation

PL_API PLEngine::EngineApplication::EngineApplication ( PLCore::Frontend cFrontend,
const PLCore::String sSceneFilename = "" 
)

Constructor.

< The used default (and very basic) scene renderer

Parameters:
[in]cFrontendFrontend this application instance is running in
[in]sSceneFilenameFilename of the scene to load

Destructor.


Member Function Documentation

Returns the scene container (the 'concrete scene')

Returns:
Scene container, can be a null pointer

Sets the scene container (the 'concrete scene')

Parameters:
[in]pContainerNew scene container, can be a null pointer

Clears the scene, after calling this method the scene is empty.

Get scene camera.

Returns:
Scene camera, can be a null pointer

Get virtual input controller.

Returns:
Virtual input controller (can be a null pointer)

Set virtual input controller.

Parameters:
[in]pInputControllerVirtual input controller (can be a null pointer)

Get scene renderer tool.

Returns:
Scene renderer tool instance
Remarks:
Use "GetSceneRendererTool()" for a simplified interface to the scene renderer. By writing for example "GetSceneRendererTool().SetPassAttribute("BackgroundBitmap", "Material", "Data/Textures/Background.dds");" one can usually (on standard scene renderer configurations) set directly a background bitmap.

This component is initialized within the application framework initialization function "OnStart()" that is called prior to "Main()". As a result, using the returned component instance prior to the application-specific initialization routine "OnInit()" will not work.

Get scene renderer tool.

Returns:
Scene renderer tool instance
See also:

Get screenshot tool.

Returns:
Screenshot tool instance
Remarks:
This component is initialized within the application framework initialization function "OnStart()" that is called prior to "Main()". As a result, using the returned component instance prior to the application-specific initialization routine "OnInit()" will not work.

Returns whether or not edit mode is enabled.

Returns:
'true' if edit mode is enabled, else 'false'
Remarks:
This class introduces some generic edit features which are enabled by default. For public release versions you may disable the edit mode so users can't for example use edit features to chat.
PL_API void PLEngine::EngineApplication::SetEditModeEnabled ( bool  bEnabled = true)

Sets whether or not edit mode is enabled.

Parameters:
[in]bEnabled'true' if edit mode is enabled, else 'false'
Remarks:
Also the scene nodes 'SNEngineInformation0' and 'SNConsole0' from the root scene are enabled/disabled. By default, edit mode is enabled.
See also:

Quit the engine.

Parameters:
[in]cCommandCalling command
virtual PL_API void PLEngine::EngineApplication::SetCamera ( PLScene::SNCamera pCamera) [virtual]

Sets the scene camera.

Parameters:
[in]pCameraNew scene camera, can be a null pointer
Note:
  • Deactivates automatically the current set camera and activates the new camera
  • Sets this camera also within the 'SPScene' surface painter instance
  • Emits the "SignalCameraSet"-signal
virtual PL_API bool PLEngine::EngineApplication::LoadScene ( const PLCore::String sFilename) [virtual]

Loads a scene.

Parameters:
[in]sFilenameFilename of the scene to load
Returns:
'true' if all went fine, else 'false'
Remarks:
This function will use the current set scene container (the 'concrete scene') to load in given scene data. It will temporarily add a new base path so all scene data can be found even if the scene to load is not within the application directory. Supported 'SNKeyValue' information: Key Value 'SceneRenderer' 'Class name of the scene renderer to use' 'SceneRendererVariables' '<Variable>=

' 'ClearColor' '<red> <green> <blue> <alpha>' (all floating point values from 0-1) 'StartCamera' '<name of="" the="" start="" camera="" scene="" node>="">' (name is relative to the loaded scene container)

Note:
  • If currently the edit dialog is opened, it will be closed automatically to avoid update problems
  • Emits the "SignalSceneLoadingFinished"-signal when the scene loading has been finished successfully
virtual PL_API bool PLEngine::EngineApplication::OnStart ( ) [override, protected, virtual]

Initialization function that is called prior to OnInit()

Returns:
'true' if all went fine, else 'false' which will stop the application
Remarks:
The default implementation does the following tasks:

Reimplemented from PLScene::SceneApplication.

Reimplemented in PLEngine::ScriptApplication.

virtual PL_API void PLEngine::EngineApplication::OnResume ( ) [override, protected, virtual]

Called when the object has the focus (keep the implementation lightweight)

Remarks:
The default implementation does the following tasks:

Reimplemented from PLCore::CoreApplication.

virtual PL_API void PLEngine::EngineApplication::OnPause ( ) [override, protected, virtual]

Called when the object has no longer the focus (keep the implementation lightweight)

Remarks:
The default implementation does the following tasks:

Reimplemented from PLCore::CoreApplication.

virtual PL_API void PLEngine::EngineApplication::OnStop ( ) [override, protected, virtual]

De-initialization function that is called after OnDeInit()

Remarks:
The default implementation does the following tasks:

Reimplemented from PLScene::SceneApplication.

Reimplemented in PLEngine::ScriptApplication.

virtual PL_API void PLEngine::EngineApplication::OnUpdate ( ) [override, protected, virtual]

Called to let the frontend update it's states.

Remarks:
The default implementation does the following tasks:

Reimplemented from PLScene::SceneApplication.

Reimplemented in PLEngine::ScriptApplication.

virtual PL_API void PLEngine::EngineApplication::OnCreateRootScene ( ) [override, protected, virtual]

Function that is called to create the application's root scene.

Note:
  • Part of the application framework initialization function "OnStart()"
  • The default implementation creates a standard root scene

Reimplemented from PLScene::SceneApplication.

virtual PL_API void PLEngine::EngineApplication::OnCreateScene ( PLScene::SceneContainer cContainer) [protected, virtual]

Function that is called to create the application's scene container.

Parameters:
[in]cContainerScene container where the 'concrete scene' should be created in
Note:
  • Part of the application framework initialization function "OnStart()"
  • The default implementation creates an controllable camera and a simple mesh scene node
  • Called from within "PLScene::SceneApplication::OnCreateRootScene()"
virtual PL_API void PLEngine::EngineApplication::OnCreateInputController ( ) [protected, virtual]

Function that is called to initialize the application's virtual input controller.

Note:
  • Part of the application framework initialization function "OnStart()"
  • In the default implementation, an instance of VirtualStandardController is created
virtual PL_API void PLEngine::EngineApplication::OnInputControllerFound ( PLInput::Controller pInputController,
PLCore::String  sInputSemantic 
) [protected, virtual]

Function that is called when an input controller has been found.

Parameters:
[in]pInputControllerFound input controller, always valid
[in]sInputSemanticPurpose of this input controller
Remarks:
Use this virtual method for instance to connect the input controller to real input devices.
Note:
  • Connected to the "PLInput::InputManager::EventInputControllerFound"-event
  • The default implementation tries to connect all controls automatically with the virtual standard controller

Member Data Documentation

Scene node handler for the scene container

Scene node handler for the camera

Default scene renderer

Clear color

Name of the given start camera

First found camera, can be a null pointer

Keys to process AFTER all other

Is there a load screen?

Virtual input controller, can be a null pointer

Scene renderer tool

Screenshot tool

Edit mode enabled?


The documentation for this class was generated from the following file:


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