Nebula
Loading...
Searching...
No Matches
frameevent.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
9//------------------------------------------------------------------------------
10#include "game/processor.h"
12
13namespace Game
14{
15
16class FramePipeline;
17
23
29
30//------------------------------------------------------------------------------
34{
35public:
36 FrameEvent() = default;
38
39 class Batch;
40
41 void Run(World* world);
42 void AddProcessor(Processor* processor);
43
45 void Prefilter(World* world, bool force = false);
48
50 int order = 100;
51
53
54private:
56
59
62};
63
64
65//------------------------------------------------------------------------------
70{
71public:
72 Batch() = default;
73 ~Batch();
74
75 void Execute(World* world);
76
83 bool TryInsert(Processor* processor);
84
86 void Prefilter(World* world, bool force = false);
89
91 int order = 100;
92 bool async = false;
93
95
96private:
97 void ExecuteAsync(World* world);
98 void ExecuteSequential(World* world);
99
101};
102
103
104//------------------------------------------------------------------------------
108{
109public:
110 FramePipeline() = delete;
113
116
118 void Begin();
120 void End();
122 void Reset();
124 void RunThru(Util::StringAtom name);
126 void RunRemaining();
127
129 bool IsRunningAsync();
130
132 void Prefilter(bool force = false);
135
136 // get read copy of frame events. This is not thread safe to read from!
138
139private:
141
143 bool isRunning = false;
144 volatile bool inAsync = false;
147};
148
149} // namespace Game
A batch of frame callbacks.
Definition frameevent.h:70
void ExecuteAsync(World *world)
Definition frameevent.cc:265
Util::Array< Processor * > processors
Definition frameevent.h:100
int order
sorting order in frame event
Definition frameevent.h:91
void Execute(World *world)
Definition frameevent.cc:153
bool async
Definition frameevent.h:92
~Batch()
Definition frameevent.cc:141
void CacheTable(MemDb::TableId, MemDb::TableSignature const &)
add a table to the cache of any processors that accepts it, that is attached to this frame batch
Definition frameevent.cc:225
void Prefilter(World *world, bool force=false)
prefilter all processors. Should not be done per frame - instead use CacheTable if you need to do inc...
Definition frameevent.cc:208
void ExecuteSequential(World *world)
Definition frameevent.cc:316
bool TryInsert(Processor *processor)
Try to insert a processor into the batch.
Definition frameevent.cc:169
Util::Array< Processor const * > GetProcessors() const
Definition frameevent.cc:250
Definition frameevent.h:34
void AddProcessor(Processor *processor)
Definition frameevent.cc:67
Util::Array< Batch const * > const GetBatches() const
Definition frameevent.cc:127
int order
Definition frameevent.h:50
Util::Array< Batch * > batches
Batches that this event will execute.
Definition frameevent.h:61
FrameEvent()=default
FramePipeline * pipeline
Which pipeline is this event attached to.
Definition frameevent.h:58
void CacheTable(MemDb::TableId, MemDb::TableSignature const &)
add a table to the caches of any processors that accepts it, that is attached to this frame event
Definition frameevent.cc:115
void Run(World *world)
Definition frameevent.cc:48
friend FramePipeline
Definition frameevent.h:55
void Prefilter(World *world, bool force=false)
prefilter all processors. Should not be done per frame - instead use CacheTable if you need to do inc...
Definition frameevent.cc:103
Util::StringAtom name
Definition frameevent.h:49
~FrameEvent()
Definition frameevent.cc:36
Definition frameevent.h:108
volatile bool inAsync
Definition frameevent.h:144
Util::Array< FrameEvent const * > const GetFrameEvents() const
Definition frameevent.cc:505
void RunRemaining()
Run until the pipeline ends.
Definition frameevent.cc:458
void Prefilter(bool force=false)
prefilter all processors. Should not be done per frame - instead use CacheTable if you need to do inc...
Definition frameevent.cc:481
void Reset()
Reset the pipeline to the start.
Definition frameevent.cc:430
void Begin()
Start running the pipeline.
Definition frameevent.cc:412
friend FrameEvent
Definition frameevent.h:140
IndexT currentIndex
Definition frameevent.h:145
bool isRunning
Definition frameevent.h:143
bool IsRunningAsync()
check if the pipeline is currently executing an async frame event batch
Definition frameevent.cc:472
World * world
Definition frameevent.h:142
Util::Array< FrameEvent * > frameEvents
Definition frameevent.h:146
void CacheTable(MemDb::TableId, MemDb::TableSignature const &)
add a table to the caches of any processors that accepts it, that is attached to this frame event
Definition frameevent.cc:493
FrameEvent * GetFrameEvent(Util::StringAtom name)
Definition frameevent.cc:396
void End()
Stop running the pipeline.
Definition frameevent.cc:423
void RunThru(Util::StringAtom name)
Run and execute until a certain event is executed (inclusive)
Definition frameevent.cc:439
~FramePipeline()
Definition frameevent.cc:351
FrameEvent * RegisterFrameEvent(int order, Util::StringAtom name)
Definition frameevent.cc:363
Definition processor.h:22
Definition world.h:50
Basically a bitfield with packed ComponentIds.
Definition tablesignature.h:26
Nebula's dynamic array class.
Definition array.h:60
A StringAtom.
Definition stringatom.h:22
Game::EditorState.
Definition orientation.h:7
This represents a "view" into an entity table.
Definition frameevent.h:25
ProcessorJobInput * inputs
Definition frameevent.h:27
Game::World * world
Definition frameevent.h:26
Definition frameevent.h:19
Game::Dataset::View * view
Definition frameevent.h:20
Processor * processor
Definition frameevent.h:21
Table identifier.
Definition tableid.h:14
int IndexT
Definition types.h:48