185 return GraphicsServer::Instance()->CreateGraphicsEntity();
194 GraphicsServer::Instance()->DiscardGraphicsEntity(
id);
200template<
typename ... CONTEXTS>
204 (CONTEXTS::RegisterEntity(
id), ...);
210template<
typename ... CONTEXTS>
214 (CONTEXTS::DeregisterEntity(
id), ...);
The common base class of Nebula.
Definition refcounted.h:38
Definition graphicscontext.h:165
The graphics server is the main singleton for the Graphics subsystem.
Definition graphicsserver.h:47
void Render()
Render views.
Definition graphicsserver.cc:544
void SetupPreLogicViewCalls(const Util::Array< ViewDependentCall > &calls)
Setup per-view calls.
Definition graphicsserver.h:293
Util::Array< PostViewCallback > postViewCallbacks
Definition graphicsserver.h:161
void RunPostLogic()
Run post-logic calls.
Definition graphicsserver.cc:507
void DiscardStage(const Ptr< Stage > &stage)
discard stage
Definition graphicsserver.cc:350
void SetResizeCall(void(*)(const SizeT, const SizeT))
Set a function to be run when resize.
Definition graphicsserver.h:257
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...
Definition graphicsserver.cc:421
void DiscardGraphicsEntity(const GraphicsEntityId id)
discard graphics entity
Definition graphicsserver.cc:321
void(*)(IndexT, IndexT) PreViewCallback
Definition graphicsserver.h:81
void Close()
closes the graphics server
Definition graphicsserver.cc:233
void AddPostViewCall(PostViewCallback callback)
Add callback for rendering after the views are processed.
Definition graphicsserver.h:248
Util::Array< ViewIndependentCall > postLogicCalls
Definition graphicsserver.h:171
Util::Dictionary< Util::StringAtom, Ptr< View > > viewsByName
Definition graphicsserver.h:155
const Timing::Time GetFrameTime() const
get frame time in seconds
Definition graphicsserver.h:320
Util::Array< GraphicsContextState * > states
Definition graphicsserver.h:152
Ptr< View > CreateView(const Util::StringAtom &name, void(*)(const Math::rectangle< int > &, IndexT, IndexT), const Math::rectangle< int > &viewport)
create a new view with a new framescript
Definition graphicsserver.cc:361
void NewFrame()
Progress to next frame.
Definition graphicsserver.cc:622
void SetupPreLogicCalls(const Util::Array< ViewIndependentCall > &calls)
Setup pre game logic graphics calls.
Definition graphicsserver.h:275
GraphicsEntityId CreateGraphicsEntity()
create graphics entity
Definition graphicsserver.cc:310
FrameContext frameContext
Definition graphicsserver.h:149
Util::Array< GraphicsContextFunctionBundle * > contexts
Definition graphicsserver.h:151
Util::Array< ViewDependentCall > preLogicViewCalls
Definition graphicsserver.h:172
const Ptr< View > & GetCurrentView() const
get current view
Definition graphicsserver.h:230
GraphicsServer()
constructor
Definition graphicsserver.cc:42
const Timing::Time GetTime() const
get total time in seconds
Definition graphicsserver.h:311
void(*)(IndexT, IndexT) PostViewCallback
Definition graphicsserver.h:82
void OnWindowResized(CoreGraphics::WindowId wndId)
call when the window has been resized
Definition graphicsserver.cc:287
const IndexT GetFrameIndex() const
get frame index
Definition graphicsserver.h:329
Ptr< CoreGraphics::ShapeRenderer > shapeRenderer
Definition graphicsserver.h:168
void SetupPostLogicCalls(const Util::Array< ViewIndependentCall > &calls)
Setup post game logic graphics calls.
Definition graphicsserver.h:284
Ptr< CoreGraphics::ShaderServer > shaderServer
Definition graphicsserver.h:167
Util::Array< Ptr< Stage > > stages
Definition graphicsserver.h:154
bool isOpen
Definition graphicsserver.h:176
Ids::IdGenerationPool entityPool
Definition graphicsserver.h:145
Util::Array< PreViewCallback > preViewCallbacks
Definition graphicsserver.h:160
Ptr< FrameSync::FrameSyncTimer > timer
Definition graphicsserver.h:147
void DiscardView(const Ptr< View > &view)
discard view
Definition graphicsserver.cc:404
void Open()
opens the graphics server
Definition graphicsserver.cc:61
__DeclareSingleton(GraphicsServer)
const Ptr< View > & GetView(const Util::StringAtom &name)
Get view by name.
Definition graphicsserver.h:221
SwapInfo swapInfo
Definition graphicsserver.h:174
void RenderDebug(uint32_t flags)
debug rendering
Definition graphicsserver.cc:430
Ptr< CoreGraphics::TextRenderer > textRenderer
Definition graphicsserver.h:169
void RegisterGraphicsContext(GraphicsContextFunctionBundle *context, GraphicsContextState *state)
register function bundle from graphics context, see GraphicsContextType::Create
Definition graphicsserver.cc:265
bool graphicsDevice
Definition graphicsserver.h:166
void SetupPostLogicViewCalls(const Util::Array< ViewDependentCall > &calls)
Setup per-view calls.
Definition graphicsserver.h:302
void SetSwapInfo(const SwapInfo &info)
Setup the swap info.
Definition graphicsserver.h:266
Util::Array< ViewIndependentCall > preLogicCalls
Definition graphicsserver.h:171
void UnregisterGraphicsContext(GraphicsContextFunctionBundle *context)
unregister function bundle
Definition graphicsserver.cc:275
void RunPreLogic()
Run pre-logic calls.
Definition graphicsserver.cc:444
void AddPreViewCall(PreViewCallback callback)
Add callback for rendering before the views are processed.
Definition graphicsserver.h:239
Util::Array< Ptr< View > > views
Definition graphicsserver.h:156
void EndFrame()
End the frame and submit.
Definition graphicsserver.cc:577
Util::Array< ViewDependentCall > postLogicViewCalls
Definition graphicsserver.h:172
Ptr< CoreGraphics::DisplayDevice > displayDevice
Definition graphicsserver.h:165
Ptr< Stage > CreateStage(const Util::StringAtom &name, bool main)
create a new stage
Definition graphicsserver.cc:339
bool IsValidGraphicsEntity(const GraphicsEntityId id)
check if graphics entity is valid
Definition graphicsserver.cc:330
virtual ~GraphicsServer()
destructor
Definition graphicsserver.cc:52
bool ownsTimer
Definition graphicsserver.h:148
Ptr< View > currentView
Definition graphicsserver.h:157
void(* resizeCall)(const SizeT, const SizeT)
Definition graphicsserver.h:163
__DeclareClass(GraphicsServer)
A view describes a camera which can observe a Stage.
Definition view.h:23
Provides a system for creating array friendly id numbers with reuse and generations.
Definition idgenerationpool.h:43
A 2d rectangle class.
Definition rectangle.h:20
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Nebula's dynamic array class.
Definition array.h:60
void Append(const TYPE &first, const ELEM_TYPE &... elements)
Append multiple elements to the end of the array.
Definition array.h:1334
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
A StringAtom.
Definition stringatom.h:22
Implements the shader server used by Vulkan.
Definition cameramanager.h:21
static GraphicsEntityId CreateEntity()
Definition graphicsserver.h:183
void(*)(const Graphics::FrameContext &ctx) ViewIndependentCall
Definition graphicsserver.h:39
void(*)(const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx) ViewDependentCall
Definition graphicsserver.h:40
static void RegisterEntity(const GraphicsEntityId id)
Definition graphicsserver.h:202
static void DeregisterEntity(const GraphicsEntityId id)
Definition graphicsserver.h:212
static void DestroyEntity(const GraphicsEntityId id)
Definition graphicsserver.h:192
int Tick
the tick datatype (one tick == 1 millisecond)
Definition time.h:20
double Time
the time datatype
Definition time.h:18
Vulkan::GraphicsDeviceState state
Definition commandbuffer.h:155
Definition graphicsdevice.h:101
texture type
Definition texture.h:25
Definition graphicsserver.h:31
Timing::Time frameTime
Definition graphicsserver.h:34
Timing::Time time
Definition graphicsserver.h:32
IndexT bufferIndex
Definition graphicsserver.h:36
Timing::Tick ticks
Definition graphicsserver.h:33
IndexT frameIndex
Definition graphicsserver.h:35
Definition graphicscontext.h:114
A graphics context is a resource which holds a contextual representation for a graphics entity.
Definition graphicscontext.h:136
The graphics entity is only an Id, to which we can attach GraphicsContexts.
Definition graphicsentity.h:16
Definition graphicsserver.h:91
CoreGraphics::TextureId swapSource
Definition graphicsserver.h:93
CoreGraphics::SubmissionWaitEvent submission
Definition graphicsserver.h:94
void(* syncFunc)(CoreGraphics::CmdBufferId)
Definition graphicsserver.h:92
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48