49#ifdef NEBULA_ENABLE_PROFILING
59 template <
typename... TYPES, std::size_t... Is>
65 *((
typename std::remove_const<
typename std::remove_reference<TYPES>::type>::type*)view.
buffers[Is] + instance)...
69 template <
typename... COMPONENTS>
71 ForEach(std::function<
void(
World*, COMPONENTS...)> func, uint8_t bufferStartOffset)
76 while (i < view.numInstances)
79 if (!view.validInstances.SectionIsNull(i / 64))
82 for (uint32_t instance = i; instance < end; ++instance)
85 if (view.validInstances.IsSet(instance))
93 std::make_index_sequence<
sizeof...(COMPONENTS)>()
104 template <
typename... COMPONENTS>
111 while (i < view.numInstances)
115 uint64_t section = i / 64;
116 if (!view.validInstances.SectionIsNull(section) && !view.modifiedInstances.SectionIsNull(section))
119 for (uint32_t instance = i; instance < end; ++instance)
122 if (view.validInstances.IsSet(instance) && view.modifiedInstances.IsSet(instance))
130 std::make_index_sequence<
sizeof...(COMPONENTS)>()
149 template<
typename LAMBDA>
153 template<
typename ...COMPONENTS>
157 template<
typename ... COMPONENTS>
161 template<
typename ... COMPONENTS>
207template<
typename LAMBDA>
210 static_assert(std::is_invocable<LAMBDA()>());
211 return this->
Func(std::function(lambda));
217template<
typename ...COMPONENTS>
231template<
typename ...COMPONENTS>
241template<
typename ...COMPONENTS>
uint8_t GetNumInclusive()
Definition filter.h:149
FilterBuilder & Excluding()
Definition filter.h:139
FilterBuilder & Including()
Definition filter.h:128
Definition processor.h:143
bool async
Definition processor.h:198
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:114
ProcessorBuilder & OnlyModified()
entities must be marked as modified for them to actually be processed
Definition processor.cc:64
FilterBuilder filterBuilder
Definition processor.h:197
ProcessorBuilder & EditorOnly()
Processor only runs when the world is not simulating.
Definition processor.cc:84
std::function< void(World *, Dataset::View const &)> funcModified
Definition processor.h:196
std::function< void(World *, Dataset::View const &)> func
Definition processor.h:195
ProcessorBuilder()=delete
int order
Definition processor.h:200
ProcessorPhase phase
Definition processor.h:201
Util::StringAtom name
Definition processor.h:193
ProcessorBuilder & Func(LAMBDA)
which function to run with the processor
Definition processor.h:208
ProcessorBuilder & PlayOnly()
Processor only runs when the world is simulating.
Definition processor.cc:94
ProcessorBuilder & Excluding()
entities must not have any of these components
Definition processor.h:242
ProcessorBuilder & Async()
processor should run async
Definition processor.cc:54
ProcessorBuilder & Including()
entities must have these components
Definition processor.h:232
bool onlyModified
Definition processor.h:199
ProcessorBuilder & RunInEditor()
Processor should always run, even in editor; when the game is paused.
Definition processor.cc:104
ProcessorBuilder & On(Util::StringAtom eventName)
select on which event the processor is executed
Definition processor.cc:38
World * world
Definition processor.h:192
Util::StringAtom onEvent
Definition processor.h:194
Definition processor.h:31
Util::String name
name of the processor
Definition processor.h:34
friend ProcessorBuilder
Definition processor.h:57
int order
sorting order within frame event (same as batch order).
Definition processor.h:36
Filter filter
filter used for creating the dataset
Definition processor.h:40
bool active
set to false if the processor shouldn't execute in the frame.
Definition processor.h:48
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:61
bool cacheValid
set to false if the cache is invalid
Definition processor.h:46
ProcessorPhase phase
which world modes this processor is allowed to run in
Definition processor.h:54
bool async
set if this processor should run as a job.
Definition processor.h:38
static std::function< void(World *, Dataset::View const &)> ForEachModified(std::function< void(World *, COMPONENTS...)> func, uint8_t bufferStartOffset)
Definition processor.h:106
std::function< void(World *, Dataset::View const &)> callback
function that this processor runs
Definition processor.h:42
static std::function< void(World *, Dataset::View const &)> ForEach(std::function< void(World *, COMPONENTS...)> func, uint8_t bufferStartOffset)
Definition processor.h:71
Util::Array< MemDb::TableId > cache
cached tables that fulfill the requirements of the filter
Definition processor.h:44
A container of entities, their components, and processors.
Definition world.h:85
Nebula's dynamic array class.
Definition array.h:61
A StringAtom.
Definition stringatom.h:22
Nebula's universal string class.
Definition string.h:50
Resolves local hierarchical transforms into the mandatory world transform components.
Definition graphicsmanager.h:66
uint32_t Filter
Opaque filter identifier.
Definition filter.h:26
ProcessorPhase
which world mode a processor is allowed to run in
Definition processor.h:24
@ BothPhases
Definition processor.h:27
@ PlayPhase
Definition processor.h:26
@ EditorPhase
Definition processor.h:25
__forceinline TYPE min(TYPE a, TYPE b)
Definition scalar.h:399
This represents a "view" into an entity table.
Definition dataset.h:35
void * buffers[MAX_COMPONENT_BUFFERS]
component buffers.
Definition dataset.h:43
int IndexT
Definition types.h:41