75 , std::function<
void(
IndexT,
IndexT)> preViewCallback =
nullptr
76 , std::function<
void(
IndexT,
IndexT)> postViewCallback =
nullptr
182 return GraphicsServer::Instance()->CreateGraphicsEntity();
191 GraphicsServer::Instance()->DiscardGraphicsEntity(
id);
197template<
typename ... CONTEXTS>
201 (CONTEXTS::RegisterEntity(
id), ...);
207template<
typename ... CONTEXTS>
211 (CONTEXTS::DeregisterEntity(
id), ...);
217template<
typename ... CONTEXTS>
221 (CONTEXTS::DeregisterEntityImmediate(
id), ...);
The common base class of Nebula.
Definition refcounted.h:38
Definition graphicscontext.h:175
Graphics::ViewId currentView
Definition graphicsserver.h:153
const Util::Array< CoreGraphics::WindowId > & GetWindows() const
Get windows.
Definition graphicsserver.cc:392
void DiscardView(const Graphics::ViewId view)
discard view
Definition graphicsserver.cc:459
void Render()
Render views.
Definition graphicsserver.cc:604
void SetupPreLogicViewCalls(const Util::Array< ViewDependentCall > &calls)
Setup per-view calls.
Definition graphicsserver.h:255
void RunPostLogic()
Run post-logic calls.
Definition graphicsserver.cc:588
Util::Dictionary< Util::StringAtom, Graphics::ViewId > viewsByName
Definition graphicsserver.h:151
void SetResizeCall(void(*)(const SizeT, const SizeT))
Set a function to be run when resize.
Definition graphicsserver.h:228
void DiscardGraphicsEntity(const GraphicsEntityId id)
discard graphics entity
Definition graphicsserver.cc:343
SizeT maxWindowWidth
Definition graphicsserver.h:171
void Close()
closes the graphics server
Definition graphicsserver.cc:238
Util::Array< ViewIndependentCall > postLogicCalls
Definition graphicsserver.h:167
Graphics::ViewId CreateView(const Util::StringAtom &name, bool(*renderFunction)(const Math::rectangle< int > &, IndexT, IndexT), const Math::rectangle< int > &viewport, Graphics::StageMask stageMask=PRIMARY_STAGE_MASK, std::function< void(IndexT, IndexT)> preViewCallback=nullptr, std::function< void(IndexT, IndexT)> postViewCallback=nullptr)
create a new view with a new framescript
Definition graphicsserver.cc:401
const Timing::Time GetFrameTime() const
get frame time in seconds
Definition graphicsserver.h:282
Util::Array< GraphicsContextState * > states
Definition graphicsserver.h:149
const Graphics::ViewId GetView(const Util::StringAtom &name)
Get view by name.
Definition graphicsserver.cc:485
void NewFrame()
Progress to next frame.
Definition graphicsserver.cc:695
void SetupPreLogicCalls(const Util::Array< ViewIndependentCall > &calls)
Setup pre game logic graphics calls.
Definition graphicsserver.h:237
GraphicsEntityId CreateGraphicsEntity()
create graphics entity
Definition graphicsserver.cc:332
FrameContext frameContext
Definition graphicsserver.h:146
Util::Array< GraphicsContextFunctionBundle * > contexts
Definition graphicsserver.h:148
Util::Array< ViewDependentCall > preLogicViewCalls
Definition graphicsserver.h:168
GraphicsServer()
constructor
Definition graphicsserver.cc:42
void AddEndFrameCall(void(*func)(IndexT frameIndex, IndexT bufferIndex))
Add callback to run just before frame is finished.
Definition graphicsserver.cc:503
const Timing::Time GetTime() const
get total time in seconds
Definition graphicsserver.h:273
const IndexT GetFrameIndex() const
get frame index
Definition graphicsserver.h:291
Ptr< CoreGraphics::ShapeRenderer > shapeRenderer
Definition graphicsserver.h:164
void SetupPostLogicCalls(const Util::Array< ViewIndependentCall > &calls)
Setup post game logic graphics calls.
Definition graphicsserver.h:246
bool OnWindowResized(CoreGraphics::WindowId wndId)
call when the window has been resized
Definition graphicsserver.cc:307
Ptr< CoreGraphics::ShaderServer > shaderServer
Definition graphicsserver.h:163
void AddWindow(const CoreGraphics::WindowId window)
Add window to update.
Definition graphicsserver.cc:361
bool isOpen
Definition graphicsserver.h:173
Ids::IdGenerationPool entityPool
Definition graphicsserver.h:142
void RemoveWindow(const CoreGraphics::WindowId window)
Remove window.
Definition graphicsserver.cc:381
Util::Array< std::function< void(IndexT, IndexT)> > postViewCallbacks
Definition graphicsserver.h:156
Ptr< FrameSync::FrameSyncTimer > timer
Definition graphicsserver.h:144
Util::Array< CoreGraphics::WindowId > windows
Definition graphicsserver.h:170
void Open()
opens the graphics server
Definition graphicsserver.cc:64
__DeclareSingleton(GraphicsServer)
Util::Array< Graphics::ViewId > views
Definition graphicsserver.h:152
void RenderDebug(uint32_t flags)
debug rendering
Definition graphicsserver.cc:512
Util::Array< std::function< void(IndexT, IndexT)> > endFrameCallbacks
Definition graphicsserver.h:157
Ptr< CoreGraphics::TextRenderer > textRenderer
Definition graphicsserver.h:165
void RegisterGraphicsContext(GraphicsContextFunctionBundle *context, GraphicsContextState *state)
register function bundle from graphics context, see GraphicsContextType::Create
Definition graphicsserver.cc:277
SizeT maxWindowHeight
Definition graphicsserver.h:171
bool graphicsDevice
Definition graphicsserver.h:162
void SetupPostLogicViewCalls(const Util::Array< ViewDependentCall > &calls)
Setup per-view calls.
Definition graphicsserver.h:264
Util::Array< ViewIndependentCall > preLogicCalls
Definition graphicsserver.h:167
void UnregisterGraphicsContext(GraphicsContextFunctionBundle *context)
unregister function bundle
Definition graphicsserver.cc:295
void RunPreLogic()
Run pre-logic calls.
Definition graphicsserver.cc:526
void EndFrame()
End the frame and submit.
Definition graphicsserver.cc:666
Util::Array< ViewDependentCall > postLogicViewCalls
Definition graphicsserver.h:168
Ptr< CoreGraphics::DisplayDevice > displayDevice
Definition graphicsserver.h:161
void SetCurrentView(const Graphics::ViewId view)
set current view (do not use unless you know what you are doing since this is normally handled by the...
Definition graphicsserver.cc:476
bool IsValidGraphicsEntity(const GraphicsEntityId id)
check if graphics entity is valid
Definition graphicsserver.cc:352
virtual ~GraphicsServer()
destructor
Definition graphicsserver.cc:55
bool ownsTimer
Definition graphicsserver.h:145
void(* resizeCall)(const SizeT, const SizeT)
Definition graphicsserver.h:159
Util::Array< std::function< void(IndexT, IndexT)> > preViewCallbacks
Definition graphicsserver.h:155
const Graphics::ViewId GetCurrentView() const
get current view
Definition graphicsserver.cc:494
__DeclareClass(GraphicsServer)
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
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:22
static GraphicsEntityId CreateEntity()
Definition graphicsserver.h:180
void(*)(const Graphics::FrameContext &ctx) ViewIndependentCall
Definition graphicsserver.h:39
static constexpr StageMask PRIMARY_STAGE_MASK
Definition view.h:24
static void RegisterEntity(const GraphicsEntityId id)
Definition graphicsserver.h:199
uint16_t StageMask
Definition view.h:23
static void DeregisterEntityImmediate(const GraphicsEntityId id)
Definition graphicsserver.h:219
void(*)(const ViewId view, const Graphics::FrameContext &ctx) ViewDependentCall
Definition graphicsserver.h:40
static void DeregisterEntity(const GraphicsEntityId id)
Definition graphicsserver.h:209
static void DestroyEntity(const GraphicsEntityId id)
Definition graphicsserver.h:189
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 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:126
A graphics context is a resource which holds a contextual representation for a graphics entity.
Definition graphicscontext.h:146
The graphics entity is only an Id, to which we can attach GraphicsContexts.
Definition graphicsentity.h:16
int SizeT
Definition types.h:42
int IndexT
Definition types.h:41