Nebula
Loading...
Searching...
No Matches
framescript.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
18//------------------------------------------------------------------------------
19#include "core/refcounted.h"
21#include "coregraphics/buffer.h"
22#include "coregraphics/event.h"
23#include "coregraphics/shader.h"
24#include "frame/frameop.h"
25#include "frame/framepass.h"
27#include "threading/event.h"
28namespace Graphics
29{
30 class View;
31 class GraphicsServer;
32}
33
34namespace CoreGraphics
35{
36 class DrawThread;
37}
38namespace Frame
39{
41{
43public:
47 virtual ~FrameScript();
48
51
56
58 void AddOp(Frame::FrameOp* op);
60 Frame::FrameOp* GetOp(const Util::String& search);
62 void AddTexture(const Util::StringAtom& name, const CoreGraphics::TextureId tex);
68 void AddBuffer(const Util::StringAtom& name, const CoreGraphics::BufferId buf);
71
73 void Setup();
75 void Discard();
77 void Run(const IndexT frameIndex, const IndexT bufferIndex);
78
80 void Build();
81
82private:
83 friend class FrameScriptLoader;
84 friend class FrameServer;
85 friend class Graphics::View;
87
89 void Cleanup();
91 void OnWindowResized();
92
95
99
101
106
112
113 bool subScript; // if subscript, it means it can only be ran from within another script
114};
115
116//------------------------------------------------------------------------------
119inline void
121{
122 this->resId = name;
123}
124
125//------------------------------------------------------------------------------
128inline const Resources::ResourceName&
130{
131 return this->resId;
132}
133
134//------------------------------------------------------------------------------
139{
140 return this->allocator;
141}
142
143//------------------------------------------------------------------------------
146inline const CoreGraphics::TextureId
148{
149 return this->texturesByName[name];
150}
151
152//------------------------------------------------------------------------------
157{
158 return this->texturesByName;
159}
160
161//------------------------------------------------------------------------------
164inline const CoreGraphics::BufferId
166{
167 return this->buffersByName[name];
168}
169
170} // namespace Frame
The common base class of Nebula.
Definition refcounted.h:38
Definition frameop.h:32
A FrameScript describes render operations being done to produce a single frame.
Definition framescript.h:41
void AddBuffer(const Util::StringAtom &name, const CoreGraphics::BufferId buf)
add buffer
Definition framescript.cc:48
void AddOp(Frame::FrameOp *op)
add frame operation
Definition framescript.cc:59
Util::Array< CoreGraphics::EventId > events
Definition framescript.h:96
void Cleanup()
cleanup script internally
Definition framescript.cc:285
Util::Array< CoreGraphics::BufferId > buffers
Definition framescript.h:102
Frame::FrameOp * GetOp(const Util::String &search)
get frame operation, searches hierarchies using /
Definition framescript.cc:71
Util::Dictionary< Util::StringAtom, Frame::FrameOp * > opsByName
Definition framescript.h:108
void OnWindowResized()
handle resizing
Definition framescript.cc:307
void Discard()
discard script
Definition framescript.cc:123
__DeclareClass(FrameScript)
void Run(const IndexT frameIndex, const IndexT bufferIndex)
run script
Definition framescript.cc:141
Util::Array< CoreGraphics::TextureId > textures
Definition framescript.h:104
void SetResourceName(const Resources::ResourceName &name)
set name
Definition framescript.h:120
Resources::ResourceName resId
Definition framescript.h:100
FrameScript()
constructor
Definition framescript.cc:17
void AddTexture(const Util::StringAtom &name, const CoreGraphics::TextureId tex)
add texture
Definition framescript.cc:36
Util::Dictionary< Util::StringAtom, CoreGraphics::TextureId > texturesByName
Definition framescript.h:105
Util::Array< Frame::FrameOp::Compiled * > compiled
Definition framescript.h:109
void Build()
build framescript, this will delete and replace the old frame used for Run()
Definition framescript.cc:164
Util::Array< CoreGraphics::BarrierId > barriers
Definition framescript.h:97
bool subScript
Definition framescript.h:113
Util::Dictionary< Util::StringAtom, CoreGraphics::BufferId > buffersByName
Definition framescript.h:103
const Util::Dictionary< Util::StringAtom, CoreGraphics::TextureId > & GetTextures() const
get all textures
Definition framescript.h:156
CoreGraphics::WindowId window
Definition framescript.h:93
IndexT frameOpCounter
Definition framescript.h:111
Util::Array< CoreGraphics::BarrierId > resourceResetBarriers
Definition framescript.h:110
const CoreGraphics::BufferId GetBuffer(const Util::StringAtom &name)
get buffer
Definition framescript.h:165
void Setup()
setup script
Definition framescript.cc:99
Memory::ArenaAllocator< BIG_CHUNK > & GetAllocator()
get allocator
Definition framescript.h:138
Memory::ArenaAllocator< BIG_CHUNK > buildAllocator
Definition framescript.h:98
const CoreGraphics::TextureId GetTexture(const Util::StringAtom &name)
get texture
Definition framescript.h:147
const Resources::ResourceName & GetResourceName() const
get name
Definition framescript.h:129
virtual ~FrameScript()
destructor
Definition framescript.cc:28
Memory::ArenaAllocator< BIG_CHUNK > allocator
Definition framescript.h:94
Util::Array< Frame::FrameOp * > ops
Definition framescript.h:107
Definition framescriptloader.h:22
Definition frameserver.h:21
The graphics server is the main singleton for the Graphics subsystem.
Definition graphicsserver.h:47
A view describes a camera which can observe a Stage.
Definition view.h:23
Allocates memory in chunks.
Definition arenaallocator.h:36
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
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
ImGUI debug interface for inspecting frame scripts.
Definition shaderserverbase.h:52
Implements the shader server used by Vulkan.
Definition cameramanager.h:21
A shader represents an entire shader resource, containing several stages and programs.
Definition buffer.h:23
texture type
Definition texture.h:25
Definition window.h:25
Nebula's universal string class.
Definition string.h:50
int IndexT
Definition types.h:48