Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
pipeline.h
Go to the documentation of this file.
1
16#ifdef FLECS_PIPELINE
17
26#ifndef FLECS_MODULE
27#define FLECS_MODULE
28#endif
29
30#ifndef FLECS_SYSTEM
31#define FLECS_SYSTEM
32#endif
33
34#if !defined(FLECS_OS_API_IMPL) && !defined(FLECS_NO_OS_API_IMPL)
35#define FLECS_OS_API_IMPL
36#endif
37
38#ifndef FLECS_PIPELINE_H
39#define FLECS_PIPELINE_H
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45#ifndef FLECS_LEGACY
46
47#define ECS_PIPELINE_DEFINE(world, id_, ...) \
48 { \
49 ecs_pipeline_desc_t desc = {0}; \
50 ecs_entity_desc_t edesc = {0}; \
51 edesc.id = id_;\
52 edesc.name = #id_;\
53 desc.entity = ecs_entity_init(world, &edesc);\
54 desc.query.filter.expr = #__VA_ARGS__; \
55 id_ = ecs_pipeline_init(world, &desc); \
56 ecs_id(id_) = id_;\
57 } \
58 ecs_assert(id_ != 0, ECS_INVALID_PARAMETER, NULL);
59
60#define ECS_PIPELINE(world, id, ...) \
61 ecs_entity_t id = 0, ecs_id(id) = 0; ECS_PIPELINE_DEFINE(world, id, __VA_ARGS__);\
62 (void)id;\
63 (void)ecs_id(id);
64
65#define ecs_pipeline(world, ...)\
66 ecs_pipeline_init(world, &(ecs_pipeline_desc_t) __VA_ARGS__ )
67
68#endif
69
70/* Pipeline descriptor (used with ecs_pipeline_init()) */
71typedef struct ecs_pipeline_desc_t {
72 /* Existing entity to associate with pipeline (optional) */
73 ecs_entity_t entity;
74
75 /* Query descriptor. The first term of the query must match the EcsSystem
76 * component. */
77 ecs_query_desc_t query;
79
82FLECS_API
84 ecs_world_t *world,
85 const ecs_pipeline_desc_t *desc);
86
93FLECS_API
95 ecs_world_t *world,
96 ecs_entity_t pipeline);
97
104FLECS_API
106 const ecs_world_t *world);
107
126FLECS_API
128 ecs_world_t *world,
129 ecs_ftime_t delta_time);
130
137FLECS_API
139 ecs_world_t *world,
140 ecs_ftime_t scale);
141
147FLECS_API
149 ecs_world_t *world);
150
166FLECS_API
168 ecs_world_t *world,
169 ecs_entity_t pipeline,
170 ecs_ftime_t delta_time);
171
172
176
184FLECS_API
186 ecs_world_t *world,
187 int32_t threads);
188
202FLECS_API
204 ecs_world_t *world,
205 int32_t task_threads);
206
208FLECS_API
210 ecs_world_t *world);
211
215
216FLECS_API
217void FlecsPipelineImport(
218 ecs_world_t *world);
219
220#ifdef __cplusplus
221}
222#endif
223
224#endif
225
228#endif
FLECS_API void ecs_set_threads(ecs_world_t *world, int32_t threads)
Set number of worker threads.
FLECS_API void ecs_set_time_scale(ecs_world_t *world, ecs_ftime_t scale)
Set time scale.
FLECS_API void ecs_set_pipeline(ecs_world_t *world, ecs_entity_t pipeline)
Set a custom pipeline.
FLECS_API ecs_entity_t ecs_get_pipeline(const ecs_world_t *world)
Get the current pipeline.
FLECS_API bool ecs_progress(ecs_world_t *world, ecs_ftime_t delta_time)
Progress a world.
FLECS_API void ecs_reset_clock(ecs_world_t *world)
Reset world clock.
FLECS_API void ecs_run_pipeline(ecs_world_t *world, ecs_entity_t pipeline, ecs_ftime_t delta_time)
Run pipeline.
FLECS_API bool ecs_using_task_threads(ecs_world_t *world)
Returns true if task thread use have been requested.
FLECS_API void ecs_set_task_threads(ecs_world_t *world, int32_t task_threads)
Set number of worker task threads.
FLECS_API ecs_entity_t ecs_pipeline_init(ecs_world_t *world, const ecs_pipeline_desc_t *desc)
Create a custom pipeline.
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:318
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:362
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:57
Used with ecs_query_init().
Definition flecs.h:1035