3#include "Systems/ComponentSystem.h"
5#include "Components/Core/ModelComponent.h"
11#include "DynamicComponentSystem.h"
17 typedef std::function<void(Context*, EntityId)> HierarchyChangedCallback;
26 void setLoaded() { modelState |= 1; }
27 bool isLoaded()
const {
return modelState != 0; }
30 void setResourcesLoaded() { modelState |= 2; }
31 bool isResourcesLoaded()
const {
return modelState & 2; }
32 void clearResourcesLoaded() { modelState = modelState & ~2; }
34 void setGeneration(uint8_t generation) { this->generation = generation; }
35 bool isGeneration(uint8_t generation)
const {
return this->generation == generation; }
37 ResourceId getResourceId() {
return resourceId; };
38 void setResourceId(ResourceId rid) { resourceId = rid; };
40 std::vector<MaterialInstanceHandle> materials;
43 uint8_t modelState = 0;
44 uint8_t generation = 0;
46 ResourceId resourceId = NoResourceId;
54 addHierarchyCallback([](
Context * context, EntityId
id) {
55 if (context->callbacks.hierarchyChangeCallback) {
56 context->callbacks.hierarchyChangeCallback(context, id);
61 void initialize(
Context * context)
override;
62 void update(
Context * context)
override;
63 void postUpdate(
Context * context)
override;
65 int addHierarchyCallback(HierarchyChangedCallback callback);
66 void removeHierarchyCallback(
int id);
80 std::map<int, HierarchyChangedCallback> callbacks;
81 MessageId hierarchyUpdatedMessage = NoMessage;
Component system template with multiple parallel structures per component stored in separate pools si...
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Base allocator implementation.
Contains all Cogs related functionality.
ComponentIndex SizeType
Type used to track the size of pools.
Contains a model reference to instance as children to the entity the ModelComponent belongs to.
Model resources define a template for a set of connected entities, with resources such as meshes,...