41#ifdef NEBULA_ENABLE_PROFILING
45#ifdef WITH_NEBULA_EDITOR
47 bool runInEditor =
false;
53 template <
typename... TYPES, std::size_t... Is>
59 *((
typename std::remove_const<
typename std::remove_reference<TYPES>::type>::type*)view.buffers[Is] + instance)...
63 template <
typename... COMPONENTS>
65 ForEach(std::function<
void(
World*, COMPONENTS...)> func, uint8_t bufferStartOffset)
70 while (i < view.numInstances)
73 if (!view.validInstances.SectionIsNull(i / 64))
76 for (uint32_t instance = i; instance < end; ++instance)
79 if (view.validInstances.IsSet(instance))
87 std::make_index_sequence<
sizeof...(COMPONENTS)>()
98 template <
typename... COMPONENTS>
105 while (i < view.numInstances)
109 uint64_t section = i / 64;
110 if (!view.validInstances.SectionIsNull(section) && !view.modifiedInstances.SectionIsNull(section))
113 for (uint32_t instance = i; instance < end; ++instance)
116 if (view.validInstances.IsSet(instance) && view.modifiedInstances.IsSet(instance))
124 std::make_index_sequence<
sizeof...(COMPONENTS)>()
143 template<
typename LAMBDA>
147 template<
typename ...COMPONENTS>
151 template<
typename ... COMPONENTS>
155 template<
typename ... COMPONENTS>
189#ifdef WITH_NEBULA_EDITOR
190 bool runInEditor =
false;
197template<
typename LAMBDA>
200 static_assert(std::is_invocable<LAMBDA()>());
201 return this->
Func(std::function(lambda));
207template<
typename ...COMPONENTS>
211 uint8_t
const bufferStartOffset = this->
filterBuilder.GetNumInclusive();
221template<
typename ...COMPONENTS>
231template<
typename ...COMPONENTS>
Definition processor.h:137
bool async
Definition processor.h:186
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:185
std::function< void(World *, Dataset::View const &)> funcModified
Definition processor.h:184
std::function< void(World *, Dataset::View const &)> func
Definition processor.h:183
ProcessorBuilder()=delete
int order
Definition processor.h:188
Util::StringAtom name
Definition processor.h:181
ProcessorBuilder & Func(LAMBDA)
which function to run with the processor
Definition processor.h:198
ProcessorBuilder & Excluding()
entities must not have any of these components
Definition processor.h:232
ProcessorBuilder & Async()
processor should run async
Definition processor.cc:54
ProcessorBuilder & Including()
entities must have these components
Definition processor.h:222
bool onlyModified
Definition processor.h:187
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:180
Util::StringAtom onEvent
Definition processor.h:182
Definition processor.h:23
Util::String name
name of the processor
Definition processor.h:26
friend ProcessorBuilder
Definition processor.h:51
int order
sorting order within frame event (same as batch order).
Definition processor.h:28
Filter filter
filter used for creating the dataset
Definition processor.h:32
bool active
set to false if the processor shouldn't execute in the frame.
Definition processor.h:40
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:55
bool cacheValid
set to false if the cache is invalid
Definition processor.h:38
bool async
set if this processor should run as a job.
Definition processor.h:30
static std::function< void(World *, Dataset::View const &)> ForEachModified(std::function< void(World *, COMPONENTS...)> func, uint8_t bufferStartOffset)
Definition processor.h:100
std::function< void(World *, Dataset::View const &)> callback
function that this processor runs
Definition processor.h:34
static std::function< void(World *, Dataset::View const &)> ForEach(std::function< void(World *, COMPONENTS...)> func, uint8_t bufferStartOffset)
Definition processor.h:65
Util::Array< MemDb::TableId > cache
cached tables that fulfill the requirements of the filter
Definition processor.h:36
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