Nebula
Loading...
Searching...
No Matches
Graphics::GraphicsServer Class Reference

#include <graphicsserver.h>

Detailed Description

The graphics server is the main singleton for the Graphics subsystem.

Updating the GraphicsServer will progress the rendering process by one frame.

Inherits Core::RefCounted.

Classes

struct  SwapInfo
 

Public Types

using PreViewCallback = void(*)(IndexT, IndexT)
 
using PostViewCallback = void(*)(IndexT, IndexT)
 

Public Member Functions

 GraphicsServer ()
 constructor
 
virtual ~GraphicsServer ()
 destructor
 
void Open ()
 opens the graphics server
 
void Close ()
 closes the graphics server
 
GraphicsEntityId CreateGraphicsEntity ()
 create graphics entity
 
void DiscardGraphicsEntity (const GraphicsEntityId id)
 discard graphics entity
 
bool IsValidGraphicsEntity (const GraphicsEntityId id)
 check if graphics entity is valid
 
Ptr< ViewCreateView (const Util::StringAtom &name, void(*)(const Math::rectangle< int > &, IndexT, IndexT), const Math::rectangle< int > &viewport)
 create a new view with a new framescript
 
Ptr< ViewCreateView (const Util::StringAtom &name)
 create a new view without a framescript
 
const Ptr< View > & GetView (const Util::StringAtom &name)
 Get view by name.
 
void DiscardView (const Ptr< View > &view)
 discard view
 
const Ptr< View > & GetCurrentView () const
 get current view
 
void SetCurrentView (const Ptr< View > &view)
 set current view (do not use unless you know what you are doing since this is normally handled by the graphicssserver)
 
void AddPreViewCall (PreViewCallback callback)
 Add callback for rendering before the views are processed.
 
void AddPostViewCall (PostViewCallback callback)
 Add callback for rendering after the views are processed.
 
void SetResizeCall (void(*)(const SizeT, const SizeT))
 Set a function to be run when resize.
 
void SetSwapInfo (const SwapInfo &info)
 Setup the swap info.
 
Ptr< StageCreateStage (const Util::StringAtom &name, bool main)
 create a new stage
 
void DiscardStage (const Ptr< Stage > &stage)
 discard stage
 
void SetupPreLogicCalls (const Util::Array< ViewIndependentCall > &calls)
 Setup pre game logic graphics calls.
 
void SetupPostLogicCalls (const Util::Array< ViewIndependentCall > &calls)
 Setup post game logic graphics calls.
 
void SetupPreLogicViewCalls (const Util::Array< ViewDependentCall > &calls)
 Setup per-view calls.
 
void SetupPostLogicViewCalls (const Util::Array< ViewDependentCall > &calls)
 Setup per-view calls.
 
void RunPreLogic ()
 Run pre-logic calls.
 
void RunPostLogic ()
 Run post-logic calls.
 
void Render ()
 Render views.
 
void EndFrame ()
 End the frame and submit.
 
void NewFrame ()
 Progress to next frame.
 
const Timing::Time GetTime () const
 get total time in seconds
 
const Timing::Time GetFrameTime () const
 get frame time in seconds
 
const IndexT GetFrameIndex () const
 get frame index
 
void RenderDebug (uint32_t flags)
 debug rendering
 
void RegisterGraphicsContext (GraphicsContextFunctionBundle *context, GraphicsContextState *state)
 register function bundle from graphics context, see GraphicsContextType::Create
 
void UnregisterGraphicsContext (GraphicsContextFunctionBundle *context)
 unregister function bundle
 
void OnWindowResized (CoreGraphics::WindowId wndId)
 call when the window has been resized
 
- Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
 
int GetRefCount () const
 get the current refcount
 
void AddRef ()
 increment refcount by one
 
void Release ()
 decrement refcount and destroy object if refcount is zero
 
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
 
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
 
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
 
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
 
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
 
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
 
const Util::StringGetClassName () const
 get the class name
 
Util::FourCC GetClassFourCC () const
 get the class FourCC code
 

Private Member Functions

 __DeclareClass (GraphicsServer)
 
 __DeclareSingleton (GraphicsServer)
 

Private Attributes

Ids::IdGenerationPool entityPool
 
Ptr< FrameSync::FrameSyncTimertimer
 
bool ownsTimer
 
FrameContext frameContext
 
Util::Array< GraphicsContextFunctionBundle * > contexts
 
Util::Array< GraphicsContextState * > states
 
Util::Array< Ptr< Stage > > stages
 
Util::Dictionary< Util::StringAtom, Ptr< View > > viewsByName
 
Util::Array< Ptr< View > > views
 
Ptr< ViewcurrentView
 
Util::Array< PreViewCallbackpreViewCallbacks
 
Util::Array< PostViewCallbackpostViewCallbacks
 
void(* resizeCall )(const SizeT, const SizeT)
 
Ptr< CoreGraphics::DisplayDevicedisplayDevice
 
bool graphicsDevice
 
Ptr< CoreGraphics::ShaderServershaderServer
 
Ptr< CoreGraphics::ShapeRenderershapeRenderer
 
Ptr< CoreGraphics::TextRenderertextRenderer
 
Util::Array< ViewIndependentCallpreLogicCalls
 
Util::Array< ViewIndependentCallpostLogicCalls
 
Util::Array< ViewDependentCallpreLogicViewCalls
 
Util::Array< ViewDependentCallpostLogicViewCalls
 
SwapInfo swapInfo
 
bool isOpen
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
 
- Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)
 

Member Typedef Documentation

◆ PostViewCallback

◆ PreViewCallback

Constructor & Destructor Documentation

◆ GraphicsServer()

Graphics::GraphicsServer::GraphicsServer ( )

constructor

◆ ~GraphicsServer()

Graphics::GraphicsServer::~GraphicsServer ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Graphics::GraphicsServer::__DeclareClass ( GraphicsServer )
private

◆ __DeclareSingleton()

Graphics::GraphicsServer::__DeclareSingleton ( GraphicsServer )
private

◆ AddPostViewCall()

void Graphics::GraphicsServer::AddPostViewCall ( PostViewCallback callback)
inline

Add callback for rendering after the views are processed.

◆ AddPreViewCall()

void Graphics::GraphicsServer::AddPreViewCall ( PreViewCallback callback)
inline

Add callback for rendering before the views are processed.

◆ Close()

void Graphics::GraphicsServer::Close ( )

closes the graphics server

◆ CreateGraphicsEntity()

GraphicsEntityId Graphics::GraphicsServer::CreateGraphicsEntity ( )

create graphics entity

◆ CreateStage()

Ptr< Graphics::Stage > Graphics::GraphicsServer::CreateStage ( const Util::StringAtom & name,
bool main )

create a new stage

◆ CreateView() [1/2]

Ptr< Graphics::View > Graphics::GraphicsServer::CreateView ( const Util::StringAtom & name)

create a new view without a framescript

◆ CreateView() [2/2]

Ptr< Graphics::View > Graphics::GraphicsServer::CreateView ( const Util::StringAtom & name,
void(* render )(const Math::rectangle< int > &, IndexT, IndexT),
const Math::rectangle< int > & viewport )

create a new view with a new framescript

◆ DiscardGraphicsEntity()

void Graphics::GraphicsServer::DiscardGraphicsEntity ( const GraphicsEntityId id)

discard graphics entity

◆ DiscardStage()

void Graphics::GraphicsServer::DiscardStage ( const Ptr< Stage > & stage)

discard stage

◆ DiscardView()

void Graphics::GraphicsServer::DiscardView ( const Ptr< View > & view)

discard view

◆ EndFrame()

void Graphics::GraphicsServer::EndFrame ( )

End the frame and submit.

◆ GetCurrentView()

const Ptr< View > & Graphics::GraphicsServer::GetCurrentView ( ) const
inline

get current view

◆ GetFrameIndex()

const IndexT Graphics::GraphicsServer::GetFrameIndex ( ) const
inline

get frame index

◆ GetFrameTime()

const Timing::Time Graphics::GraphicsServer::GetFrameTime ( ) const
inline

get frame time in seconds

◆ GetTime()

const Timing::Time Graphics::GraphicsServer::GetTime ( ) const
inline

get total time in seconds

◆ GetView()

const Ptr< View > & Graphics::GraphicsServer::GetView ( const Util::StringAtom & name)
inline

Get view by name.

◆ IsValidGraphicsEntity()

bool Graphics::GraphicsServer::IsValidGraphicsEntity ( const GraphicsEntityId id)

check if graphics entity is valid

◆ NewFrame()

void Graphics::GraphicsServer::NewFrame ( )

Progress to next frame.

◆ OnWindowResized()

void Graphics::GraphicsServer::OnWindowResized ( CoreGraphics::WindowId wndId)

call when the window has been resized

◆ Open()

void Graphics::GraphicsServer::Open ( )

opens the graphics server

◆ RegisterGraphicsContext()

void Graphics::GraphicsServer::RegisterGraphicsContext ( GraphicsContextFunctionBundle * context,
GraphicsContextState * state )

register function bundle from graphics context, see GraphicsContextType::Create

◆ Render()

void Graphics::GraphicsServer::Render ( )

Render views.

◆ RenderDebug()

void Graphics::GraphicsServer::RenderDebug ( uint32_t flags)

debug rendering

◆ RunPostLogic()

void Graphics::GraphicsServer::RunPostLogic ( )

Run post-logic calls.

◆ RunPreLogic()

void Graphics::GraphicsServer::RunPreLogic ( )

Run pre-logic calls.

◆ SetCurrentView()

void Graphics::GraphicsServer::SetCurrentView ( const Ptr< View > & view)

set current view (do not use unless you know what you are doing since this is normally handled by the graphicssserver)

◆ SetResizeCall()

void Graphics::GraphicsServer::SetResizeCall ( void(* func )(const SizeT, const SizeT))
inline

Set a function to be run when resize.

◆ SetSwapInfo()

void Graphics::GraphicsServer::SetSwapInfo ( const SwapInfo & info)
inline

Setup the swap info.

◆ SetupPostLogicCalls()

void Graphics::GraphicsServer::SetupPostLogicCalls ( const Util::Array< ViewIndependentCall > & calls)
inline

Setup post game logic graphics calls.

◆ SetupPostLogicViewCalls()

void Graphics::GraphicsServer::SetupPostLogicViewCalls ( const Util::Array< ViewDependentCall > & calls)
inline

Setup per-view calls.

◆ SetupPreLogicCalls()

void Graphics::GraphicsServer::SetupPreLogicCalls ( const Util::Array< ViewIndependentCall > & calls)
inline

Setup pre game logic graphics calls.

◆ SetupPreLogicViewCalls()

void Graphics::GraphicsServer::SetupPreLogicViewCalls ( const Util::Array< ViewDependentCall > & calls)
inline

Setup per-view calls.

◆ UnregisterGraphicsContext()

void Graphics::GraphicsServer::UnregisterGraphicsContext ( GraphicsContextFunctionBundle * context)

unregister function bundle

Member Data Documentation

◆ contexts

Util::Array<GraphicsContextFunctionBundle*> Graphics::GraphicsServer::contexts
private

◆ currentView

Ptr<View> Graphics::GraphicsServer::currentView
private

◆ displayDevice

Ptr<CoreGraphics::DisplayDevice> Graphics::GraphicsServer::displayDevice
private

◆ entityPool

Ids::IdGenerationPool Graphics::GraphicsServer::entityPool
private

◆ frameContext

FrameContext Graphics::GraphicsServer::frameContext
private

◆ graphicsDevice

bool Graphics::GraphicsServer::graphicsDevice
private

◆ isOpen

bool Graphics::GraphicsServer::isOpen
private

◆ ownsTimer

bool Graphics::GraphicsServer::ownsTimer
private

◆ postLogicCalls

Util::Array<ViewIndependentCall> Graphics::GraphicsServer::postLogicCalls
private

◆ postLogicViewCalls

Util::Array<ViewDependentCall> Graphics::GraphicsServer::postLogicViewCalls
private

◆ postViewCallbacks

Util::Array<PostViewCallback> Graphics::GraphicsServer::postViewCallbacks
private

◆ preLogicCalls

Util::Array<ViewIndependentCall> Graphics::GraphicsServer::preLogicCalls
private

◆ preLogicViewCalls

Util::Array<ViewDependentCall> Graphics::GraphicsServer::preLogicViewCalls
private

◆ preViewCallbacks

Util::Array<PreViewCallback> Graphics::GraphicsServer::preViewCallbacks
private

◆ resizeCall

void(* Graphics::GraphicsServer::resizeCall) (const SizeT, const SizeT)
private

◆ shaderServer

Ptr<CoreGraphics::ShaderServer> Graphics::GraphicsServer::shaderServer
private

◆ shapeRenderer

Ptr<CoreGraphics::ShapeRenderer> Graphics::GraphicsServer::shapeRenderer
private

◆ stages

Util::Array<Ptr<Stage> > Graphics::GraphicsServer::stages
private

◆ states

Util::Array<GraphicsContextState*> Graphics::GraphicsServer::states
private

◆ swapInfo

SwapInfo Graphics::GraphicsServer::swapInfo
private

◆ textRenderer

Ptr<CoreGraphics::TextRenderer> Graphics::GraphicsServer::textRenderer
private

◆ timer

Ptr<FrameSync::FrameSyncTimer> Graphics::GraphicsServer::timer
private

◆ views

Util::Array<Ptr<View> > Graphics::GraphicsServer::views
private

◆ viewsByName

Util::Dictionary<Util::StringAtom, Ptr<View> > Graphics::GraphicsServer::viewsByName
private

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