~vladh/peony

73699ee29a774d2521b3fe3ce3bde1f39220e055 — Vlad-Stefan Harbuz 1 year, 7 months ago 5c3b6fe
refactor spatial::ComponentSet into just spatial::state->components
2 files changed, 5 insertions(+), 12 deletions(-)

M src/spatial.cpp
M src/spatial.hpp
M src/spatial.cpp => src/spatial.cpp +4 -7
@@ 80,14 80,14 @@ spatial::make_model_matrix(
Array<spatial::Component> *
spatial::get_components()
{
    return &spatial::state->component_set.components;
    return &spatial::state->components;
}


spatial::Component *
spatial::get_component(entities::Handle entity_handle)
{
    return spatial::state->component_set.components[entity_handle];
    return spatial::state->components[entity_handle];
}




@@ 95,9 95,6 @@ void
spatial::init(spatial::State *spatial_state, memory::Pool *asset_memory_pool)
{
    spatial::state = spatial_state;
    spatial::state->component_set = {
        .components = Array<spatial::Component>(
            asset_memory_pool, MAX_N_ENTITIES, "spatial_components", true, 1
        )
    };
    spatial::state->components =  Array<spatial::Component>(
        asset_memory_pool, MAX_N_ENTITIES, "spatial_components", true, 1);
}

M src/spatial.hpp => src/spatial.hpp +1 -5
@@ 38,12 38,8 @@ public:
        Component *last_model_matrix_spatial_component;
    };

    struct ComponentSet {
        Array<Component> components;
    };

    struct State {
        ComponentSet component_set;
        Array<Component> components;
    };