Cogs.Core
StaticModelSystem.h
1#pragma once
2
3#include "Components/Core/StaticModelComponent.h"
4
5#include "Systems/ComponentSystem.h"
6
7namespace Cogs::Core
8{
10 {
11 StaticModelData() = default;
13 StaticModelData(StaticModelData &&) = default;
15
16 void setGeneration(uint8_t generation) { this->generation = generation; }
17 bool isGeneration(uint8_t generation) const { return this->generation == generation; }
18
19 std::vector<MaterialInstanceHandle> materials;
20
21 std::shared_ptr<struct StaticModelContext> modelContext;
22
23 std::vector<ComponentModel::Entity *> roots;
24
25 private:
26 uint8_t generation = 0;
27 };
28
29 class COGSCORE_DLL_API StaticModelSystem : public ComponentSystemWithDataPool<StaticModelComponent, StaticModelData>
30 {
31 public:
32 StaticModelSystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity)
33 {
34
35 }
36
38
39 void update(Context * context) override;
40
41 class RenderSystem * getRenderSystem(StaticModelComponent * modelComponent);
42 class MeshSystem * getMeshSystem(StaticModelComponent * modelComponent);
43 struct RenderBatch * getRenderBatch(StaticModelComponent * modelComponent);
44
45 void initializeCulling(struct CullingSource* cullingSource);
46
47 private:
48 void loadModel(Context * context, const StaticModelComponent & component, StaticModelData & modelData, Model * model);
49 };
50}
Component system with parallel data per component stored in a pool similar to how the components them...
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
The mesh render system handles MeshRenderComponents.
Definition: RenderSystem.h:75
Base allocator implementation.
Definition: Allocator.h:30
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19
Model resources define a template for a set of connected entities, with resources such as meshes,...
Definition: Model.h:56