Skip to content

Commit

Permalink
Happy holidays!
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Dec 27, 2024
1 parent e92d37f commit fb0e3b1
Show file tree
Hide file tree
Showing 11 changed files with 792 additions and 653 deletions.
913 changes: 328 additions & 585 deletions deps/flecs.c

Large diffs are not rendered by default.

29 changes: 13 additions & 16 deletions deps/flecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ extern "C" {
//// Aperiodic action flags (used by ecs_run_aperiodic)
////////////////////////////////////////////////////////////////////////////////

#define EcsAperiodicEmptyTables (1u << 1u) /* Process pending empty table events */
#define EcsAperiodicComponentMonitors (1u << 2u) /* Process component monitors */
#define EcsAperiodicEmptyQueries (1u << 4u) /* Process empty queries */

Expand Down Expand Up @@ -3208,7 +3207,6 @@ typedef struct ecs_table_cache_hdr_t {
struct ecs_table_cache_t *cache; /**< Table cache of element. Of type ecs_id_record_t* for component index elements. */
ecs_table_t *table; /**< Table associated with element. */
struct ecs_table_cache_hdr_t *prev, *next; /**< Next/previous elements for id in table cache. */
bool empty; /**< Whether element is in empty list. */
} ecs_table_cache_hdr_t;

/** Metadata describing where a component id is stored in a table.
Expand Down Expand Up @@ -3758,7 +3756,8 @@ typedef struct ecs_worker_iter_t {
/* Convenience struct to iterate table array for id */
typedef struct ecs_table_cache_iter_t {
struct ecs_table_cache_hdr_t *cur, *next;
struct ecs_table_cache_hdr_t *next_list;
bool iter_fill;
bool iter_empty;
} ecs_table_cache_iter_t;

/** Each iterator */
Expand Down Expand Up @@ -4674,7 +4673,6 @@ typedef struct ecs_world_info_t {
int32_t pair_id_count; /**< Number of pair ids in the world */

int32_t table_count; /**< Number of tables */
int32_t empty_table_count; /**< Number of tables without entities */

/* -- Command counts -- */
struct {
Expand Down Expand Up @@ -5051,12 +5049,6 @@ FLECS_API extern const ecs_entity_t EcsOnTableCreate;
/** Event that triggers when a table is deleted. */
FLECS_API extern const ecs_entity_t EcsOnTableDelete;

/** Event that triggers when a table becomes empty (doesn't emit on creation). */
FLECS_API extern const ecs_entity_t EcsOnTableEmpty;

/** Event that triggers when a table becomes non-empty. */
FLECS_API extern const ecs_entity_t EcsOnTableFill;

/** Relationship used for specifying cleanup behavior. */
FLECS_API extern const ecs_entity_t EcsOnDelete;

Expand Down Expand Up @@ -14853,18 +14845,23 @@ void ecs_script_vars_from_iter(
typedef struct ecs_expr_eval_desc_t {
const char *name; /**< Script name */
const char *expr; /**< Full expression string */
const ecs_script_vars_t *vars; /**< Variables accessible in expression */
ecs_entity_t type; /**< Type of parsed value (optional) */
ecs_entity_t (*lookup_action)( /**< Function for resolving entity identifiers */
const ecs_world_t*,
const char *value,
void *ctx);
void *lookup_ctx; /**< Context passed to lookup function */
const ecs_script_vars_t *vars; /**< Variables accessible in expression */
ecs_entity_t type; /**< Type of parsed value (optional) */

/* Disable constant folding (slower evaluation, faster parsing) */

/** Disable constant folding (slower evaluation, faster parsing) */
bool disable_folding;

/* Allow for unresolved identifiers when parsing. Useful when entities can

/** This option instructs the expression runtime to lookup variables by
* stack pointer instead of by name, which improves performance. Only enable
* when provided variables are always declared in the same order. */
bool disable_dynamic_variable_binding;

/** Allow for unresolved identifiers when parsing. Useful when entities can
* be created in between parsing & evaluating. */
bool allow_unresolved_identifiers;

Expand Down
12 changes: 10 additions & 2 deletions deps/flecs_systems_sokol.c
Original file line number Diff line number Diff line change
Expand Up @@ -32757,7 +32757,9 @@ void SokolRegisterMaterial(ecs_iter_t *it) {
for (i = 0; i < it->count; i ++) {
uint16_t material_id;
if (ecs_vec_count(material_free_list)) {
material_id = ecs_vec_get_t(material_free_list, uint16_t, 0)[0];
material_id = ecs_vec_last_t(material_free_list, uint16_t)[0];
ecs_assert(material_id != 0, ECS_INTERNAL_ERROR, NULL);
ecs_vec_remove_last(material_free_list);
} else {
material_id = next_material ++;
}
Expand Down Expand Up @@ -32793,6 +32795,11 @@ void FlecsSystemsSokolMaterialsImport(
ECS_COMPONENT_DEFINE(world, SokolMaterialId);
ECS_COMPONENT_DEFINE(world, SokolMaterials);

ecs_struct(world, {
.entity = ecs_id(SokolMaterialId),
.members = {{ "value", ecs_id(ecs_u16_t) }}
});

ecs_add_pair(world, ecs_id(SokolMaterialId), EcsOnInstantiate, EcsInherit);

/* Register systems in module scope */
Expand Down Expand Up @@ -32838,7 +32845,8 @@ void FlecsSystemsSokolMaterialsImport(
});

ECS_OBSERVER(world, SokolOnMaterialRemove, EcsOnRemove,
flecs.systems.sokol.MaterialId);
flecs.systems.sokol.MaterialId(self),
?Prefab);

ecs_observer(world, {
.entity = ecs_id(SokolOnMaterialRemove),
Expand Down
4 changes: 2 additions & 2 deletions etc/assets/app.flecs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ $ {

camera {
CameraController
Position3: {12.43, 5.65, 10.20}
Rotation3: {-0.23, 4.04, 0}
Position3: {-3.41, 5.61, 12.92}
Rotation3: {0, 2.63, 0}
Camera: {
fov: 20
up: [0, 1, 0]
Expand Down
Loading

0 comments on commit fb0e3b1

Please sign in to comment.