19class ProcessorBuilder;
38#ifdef WITH_NEBULA_EDITOR
40 bool runInEditor =
false;
46 template <
typename... TYPES, std::size_t... Is>
52 *((
typename std::remove_const<
typename std::remove_reference<TYPES>::type>::type*)view.buffers[Is] + instance)...
56 template <
typename... COMPONENTS>
58 ForEach(std::function<
void(
World*, COMPONENTS...)> func, uint8_t bufferStartOffset)
63 while (i < view.numInstances)
66 if (!view.validInstances.SectionIsNull(i / 64))
69 for (uint32_t instance = i; instance < end; ++instance)
72 if (view.validInstances.IsSet(instance))
80 std::make_index_sequence<
sizeof...(COMPONENTS)>()
91 template <
typename... COMPONENTS>
98 while (i < view.numInstances)
102 uint64_t section = i / 64;
103 if (!view.validInstances.SectionIsNull(section) && !view.modifiedInstances.SectionIsNull(section))
106 for (uint32_t instance = i; instance < end; ++instance)
109 if (view.validInstances.IsSet(instance) && view.modifiedInstances.IsSet(instance))
117 std::make_index_sequence<
sizeof...(COMPONENTS)>()
136 template<
typename LAMBDA>
140 template<
typename ...COMPONENTS>
144 template<
typename ... COMPONENTS>
148 template<
typename ... COMPONENTS>
182#ifdef WITH_NEBULA_EDITOR
183 bool runInEditor =
false;
190template<
typename LAMBDA>
193 static_assert(std::is_invocable<LAMBDA()>());
194 return this->
Func(std::function(lambda));
200template<
typename ...COMPONENTS>
214template<
typename ...COMPONENTS>
224template<
typename ...COMPONENTS>
uint8_t GetNumInclusive()
Definition filter.h:149
FilterBuilder & Excluding()
Definition filter.h:139
FilterBuilder & Including()
Definition filter.h:128
Definition processor.h:130
bool async
Definition processor.h:179
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:178
std::function< void(World *, Dataset::View const &)> funcModified
Definition processor.h:177
std::function< void(World *, Dataset::View const &)> func
Definition processor.h:176
ProcessorBuilder()=delete
int order
Definition processor.h:181
Util::StringAtom name
Definition processor.h:174
ProcessorBuilder & Func(LAMBDA)
which function to run with the processor
Definition processor.h:191
ProcessorBuilder & Excluding()
entities must not have any of these components
Definition processor.h:225
ProcessorBuilder & Async()
processor should run async
Definition processor.cc:54
ProcessorBuilder & Including()
entities must have these components
Definition processor.h:215
bool onlyModified
Definition processor.h:180
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:173
Util::StringAtom onEvent
Definition processor.h:175
Definition processor.h:22
Util::String name
name of the processor
Definition processor.h:25
friend ProcessorBuilder
Definition processor.h:44
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
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:48
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:93
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:58
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.
Nebula's dynamic array class.
Definition array.h:60
A StringAtom.
Definition stringatom.h:22
Game::EditorState.
Definition graphicsmanager.h:60
uint32_t Filter
Opaque filter identifier.
Definition filter.h:26
__forceinline TYPE min(TYPE a, TYPE b)
Definition scalar.h:390
This represents a "view" into an entity table.
Nebula's universal string class.
Definition string.h:50
int IndexT
Definition types.h:48