40#ifdef WITH_NEBULA_EDITOR
42 bool runInEditor =
false;
48 template <
typename... TYPES, std::size_t... Is>
54 *((
typename std::remove_const<
typename std::remove_reference<TYPES>::type>::type*)view.buffers[Is] + instance)...
58 template <
typename... COMPONENTS>
60 ForEach(std::function<
void(
World*, COMPONENTS...)> func, uint8_t bufferStartOffset)
65 while (i < view.numInstances)
68 if (!view.validInstances.SectionIsNull(i / 64))
71 for (uint32_t instance = i; instance < end; ++instance)
74 if (view.validInstances.IsSet(instance))
82 std::make_index_sequence<
sizeof...(COMPONENTS)>()
93 template <
typename... COMPONENTS>
100 while (i < view.numInstances)
104 uint64_t section = i / 64;
105 if (!view.validInstances.SectionIsNull(section) && !view.modifiedInstances.SectionIsNull(section))
108 for (uint32_t instance = i; instance < end; ++instance)
111 if (view.validInstances.IsSet(instance) && view.modifiedInstances.IsSet(instance))
119 std::make_index_sequence<
sizeof...(COMPONENTS)>()
138 template<
typename LAMBDA>
142 template<
typename ...COMPONENTS>
146 template<
typename ... COMPONENTS>
150 template<
typename ... COMPONENTS>
184#ifdef WITH_NEBULA_EDITOR
185 bool runInEditor =
false;
192template<
typename LAMBDA>
195 static_assert(std::is_invocable<LAMBDA()>());
196 return this->
Func(std::function(lambda));
202template<
typename ...COMPONENTS>
206 uint8_t
const bufferStartOffset = this->
filterBuilder.GetNumInclusive();
216template<
typename ...COMPONENTS>
226template<
typename ...COMPONENTS>
Definition processor.h:132
bool async
Definition processor.h:181
ProcessorBuilder & Order(int order)
Set the sorting order for the processor.
Definition processor.cc:74
Processor * Build()
Build the processor and attach it to the world.
Definition processor.cc:96
ProcessorBuilder & OnlyModified()
entities must be marked as modified for them to actually be processed
Definition processor.cc:64
FilterBuilder filterBuilder
Definition processor.h:180
std::function< void(World *, Dataset::View const &)> funcModified
Definition processor.h:179
std::function< void(World *, Dataset::View const &)> func
Definition processor.h:178
ProcessorBuilder()=delete
int order
Definition processor.h:183
Util::StringAtom name
Definition processor.h:176
ProcessorBuilder & Func(LAMBDA)
which function to run with the processor
Definition processor.h:193
ProcessorBuilder & Excluding()
entities must not have any of these components
Definition processor.h:227
ProcessorBuilder & Async()
processor should run async
Definition processor.cc:54
ProcessorBuilder & Including()
entities must have these components
Definition processor.h:217
bool onlyModified
Definition processor.h:182
ProcessorBuilder & RunInEditor()
Processor should always run, even in editor; when the game is paused.
Definition processor.cc:84
ProcessorBuilder & On(Util::StringAtom eventName)
select on which event the processor is executed
Definition processor.cc:38
World * world
Definition processor.h:175
Util::StringAtom onEvent
Definition processor.h:177
Definition processor.h:22
Util::String name
name of the processor
Definition processor.h:25
friend ProcessorBuilder
Definition processor.h:46
int order
sorting order within frame event (same as batch order).
Definition processor.h:27
Filter filter
filter used for creating the dataset
Definition processor.h:31
bool active
set to false if the processor shouldn't execute in the frame.
Definition processor.h:39
static void UpdateExpander(World *world, std::function< void(World *, TYPES...)> const &func, Game::Dataset::View const &view, const IndexT instance, uint8_t const bufferStartOffset, std::index_sequence< Is... >)
Definition processor.h:50
bool cacheValid
set to false if the cache is invalid
Definition processor.h:37
bool async
set if this processor should run as a job.
Definition processor.h:29
static std::function< void(World *, Dataset::View const &)> ForEachModified(std::function< void(World *, COMPONENTS...)> func, uint8_t bufferStartOffset)
Definition processor.h:95
std::function< void(World *, Dataset::View const &)> callback
function that this processor runs
Definition processor.h:33
static std::function< void(World *, Dataset::View const &)> ForEach(std::function< void(World *, COMPONENTS...)> func, uint8_t bufferStartOffset)
Definition processor.h:60
Util::Array< MemDb::TableId > cache
cached tables that fulfill the requirements of the filter
Definition processor.h:35
A container of entities, their components, and processors.
Definition world.h:81
Nebula's dynamic array class.
Definition array.h:60
A StringAtom.
Definition stringatom.h:22
Game::EditorState.
Definition graphicsmanager.h:64
uint32_t Filter
Opaque filter identifier.
Definition filter.h:26
__forceinline TYPE min(TYPE a, TYPE b)
Definition scalar.h:399
This represents a "view" into an entity table.
Definition dataset.h:35
Nebula's universal string class.
Definition String.cs:8
int IndexT
Definition types.h:39