107 , std::function<
void(
IndexT,
IndexT)> preViewCallback =
nullptr
108 , std::function<
void(
IndexT,
IndexT)> postViewCallback =
nullptr
223 return GraphicsServer::Instance()->CreateGraphicsEntity();
232 GraphicsServer::Instance()->DiscardGraphicsEntity(
id);
238template<
typename ... CONTEXTS>
242 (CONTEXTS::RegisterEntity(
id), ...);
248template<
typename ... CONTEXTS>
252 (CONTEXTS::DeregisterEntity(
id), ...);
258template<
typename ... CONTEXTS>
262 (CONTEXTS::DeregisterEntityImmediate(
id), ...);
Definition skeletonloader.h:18
The common base class of Nebula.
Definition refcounted.h:38
Resource loader to load a GPULang shader object from a stream.
Definition gpulangshaderloader.h:18
Definition meshloader.h:18
Definition textureloader.h:23
Definition graphicscontext.h:175
Ptr< CoreGraphics::GPULangShaderLoader > shaderLoader
Definition graphicsserver.h:199
Graphics::ViewId currentView
Definition graphicsserver.h:185
const Util::Array< CoreGraphics::WindowId > & GetWindows() const
Get windows.
Definition graphicsserver.cc:429
void DiscardView(const Graphics::ViewId view)
discard view
Definition graphicsserver.cc:496
void Render()
Render views.
Definition graphicsserver.cc:641
void SetupPreLogicViewCalls(const Util::Array< ViewDependentCall > &calls)
Setup per-view calls.
Definition graphicsserver.h:296
void RunPostLogic()
Run post-logic calls.
Definition graphicsserver.cc:625
Util::Dictionary< Util::StringAtom, Graphics::ViewId > viewsByName
Definition graphicsserver.h:183
void SetResizeCall(void(*)(const SizeT, const SizeT))
Set a function to be run when resize.
Definition graphicsserver.h:269
Ptr< Models::ModelLoader > modelLoader
Definition graphicsserver.h:200
void DiscardGraphicsEntity(const GraphicsEntityId id)
discard graphics entity
Definition graphicsserver.cc:380
Ptr< CoreGraphics::TextureLoader > textureLoader
Definition graphicsserver.h:202
Ptr< Characters::SkeletonLoader > skeletonLoader
Definition graphicsserver.h:205
SizeT maxWindowWidth
Definition graphicsserver.h:212
void Close()
closes the graphics server
Definition graphicsserver.cc:275
Util::Array< ViewIndependentCall > postLogicCalls
Definition graphicsserver.h:208
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:438
const Timing::Time GetFrameTime() const
get frame time in seconds
Definition graphicsserver.h:323
Util::Array< GraphicsContextState * > states
Definition graphicsserver.h:181
const Graphics::ViewId GetView(const Util::StringAtom &name)
Get view by name.
Definition graphicsserver.cc:522
void NewFrame()
Progress to next frame.
Definition graphicsserver.cc:732
void SetupPreLogicCalls(const Util::Array< ViewIndependentCall > &calls)
Setup pre game logic graphics calls.
Definition graphicsserver.h:278
GraphicsEntityId CreateGraphicsEntity()
create graphics entity
Definition graphicsserver.cc:369
FrameContext frameContext
Definition graphicsserver.h:178
Util::Array< GraphicsContextFunctionBundle * > contexts
Definition graphicsserver.h:180
Util::Array< ViewDependentCall > preLogicViewCalls
Definition graphicsserver.h:209
GraphicsServer()
constructor
Definition graphicsserver.cc:45
void AddEndFrameCall(void(*func)(IndexT frameIndex, IndexT bufferIndex))
Add callback to run just before frame is finished.
Definition graphicsserver.cc:540
const Timing::Time GetTime() const
get total time in seconds
Definition graphicsserver.h:314
const IndexT GetFrameIndex() const
get frame index
Definition graphicsserver.h:332
Ptr< CoreGraphics::ShapeRenderer > shapeRenderer
Definition graphicsserver.h:196
void SetupPostLogicCalls(const Util::Array< ViewIndependentCall > &calls)
Setup post game logic graphics calls.
Definition graphicsserver.h:287
bool OnWindowResized(CoreGraphics::WindowId wndId)
call when the window has been resized
Definition graphicsserver.cc:344
Ptr< CoreGraphics::ShaderServer > shaderServer
Definition graphicsserver.h:195
Ptr< CoreGraphics::MeshLoader > meshLoader
Definition graphicsserver.h:201
void AddWindow(const CoreGraphics::WindowId window)
Add window to update.
Definition graphicsserver.cc:398
bool isOpen
Definition graphicsserver.h:214
Ids::IdGenerationPool entityPool
Definition graphicsserver.h:174
void RemoveWindow(const CoreGraphics::WindowId window)
Remove window.
Definition graphicsserver.cc:418
Util::Array< std::function< void(IndexT, IndexT)> > postViewCallbacks
Definition graphicsserver.h:188
Ptr< FrameSync::FrameSyncTimer > timer
Definition graphicsserver.h:176
Util::Array< CoreGraphics::WindowId > windows
Definition graphicsserver.h:211
void Open()
opens the graphics server
Definition graphicsserver.cc:67
__DeclareSingleton(GraphicsServer)
Util::Array< Graphics::ViewId > views
Definition graphicsserver.h:184
void RenderDebug(uint32_t flags)
debug rendering
Definition graphicsserver.cc:549
Util::Array< std::function< void(IndexT, IndexT)> > endFrameCallbacks
Definition graphicsserver.h:189
Ptr< CoreGraphics::TextRenderer > textRenderer
Definition graphicsserver.h:197
void RegisterGraphicsContext(GraphicsContextFunctionBundle *context, GraphicsContextState *state)
register function bundle from graphics context, see GraphicsContextType::Create
Definition graphicsserver.cc:314
SizeT maxWindowHeight
Definition graphicsserver.h:212
bool graphicsDevice
Definition graphicsserver.h:194
void SetupPostLogicViewCalls(const Util::Array< ViewDependentCall > &calls)
Setup per-view calls.
Definition graphicsserver.h:305
Util::Array< ViewIndependentCall > preLogicCalls
Definition graphicsserver.h:208
void UnregisterGraphicsContext(GraphicsContextFunctionBundle *context)
unregister function bundle
Definition graphicsserver.cc:332
void RunPreLogic()
Run pre-logic calls.
Definition graphicsserver.cc:563
Ptr< Particles::ParticleLoader > particleLoader
Definition graphicsserver.h:206
void EndFrame()
End the frame and submit.
Definition graphicsserver.cc:703
Util::Array< ViewDependentCall > postLogicViewCalls
Definition graphicsserver.h:209
Ptr< Materials::MaterialLoader > materialLoader
Definition graphicsserver.h:203
Ptr< CoreGraphics::DisplayDevice > displayDevice
Definition graphicsserver.h:193
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:513
bool IsValidGraphicsEntity(const GraphicsEntityId id)
check if graphics entity is valid
Definition graphicsserver.cc:389
Ptr< CoreAnimation::AnimationLoader > animationLoader
Definition graphicsserver.h:204
virtual ~GraphicsServer()
destructor
Definition graphicsserver.cc:58
bool ownsTimer
Definition graphicsserver.h:177
void(* resizeCall)(const SizeT, const SizeT)
Definition graphicsserver.h:191
Util::Array< std::function< void(IndexT, IndexT)> > preViewCallbacks
Definition graphicsserver.h:187
const Graphics::ViewId GetCurrentView() const
get current view
Definition graphicsserver.cc:531
__DeclareClass(GraphicsServer)
Provides a system for creating array friendly id numbers with reuse and generations.
Definition idgenerationpool.h:43
Definition materialloader.h:24
A 2d rectangle class.
Definition rectangle.h:20
Definition modelloader.h:27
Definition particleloader.h:19
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:61
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:35
A StringAtom.
Definition stringatom.h:22
A character encapsulates a skeleton resource, an animation resource, and the ability to instantiate s...
Definition charactercontext.cc:21
An animation resource holds a set of animations from a loaded NAX file.
Definition charactercontext.h:40
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
Implements the shader server used by Vulkan.
Definition cameramanager.h:22
static GraphicsEntityId CreateEntity()
Definition graphicsserver.h:221
void(*)(const Graphics::FrameContext &ctx) ViewIndependentCall
Definition graphicsserver.h:71
static constexpr StageMask PRIMARY_STAGE_MASK
Definition view.h:24
static void RegisterEntity(const GraphicsEntityId id)
Definition graphicsserver.h:240
uint16_t StageMask
Definition view.h:23
static void DeregisterEntityImmediate(const GraphicsEntityId id)
Definition graphicsserver.h:260
void(*)(const ViewId view, const Graphics::FrameContext &ctx) ViewDependentCall
Definition graphicsserver.h:72
static void DeregisterEntity(const GraphicsEntityId id)
Definition graphicsserver.h:250
static void DestroyEntity(const GraphicsEntityId id)
Definition graphicsserver.h:230
Material special version of variant.
Definition graphicsserver.h:40
A model resource consists of nodes, each of which inhibit some information read from an ....
Definition graphicsserver.h:35
Particle context controls playing and enabling/disabling of particle attrs inside a model.
Definition graphicsserver.h:55
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:63
Timing::Time frameTime
Definition graphicsserver.h:66
Timing::Time time
Definition graphicsserver.h:64
IndexT bufferIndex
Definition graphicsserver.h:68
Timing::Tick ticks
Definition graphicsserver.h:65
IndexT frameIndex
Definition graphicsserver.h:67
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