Cogs.Core
Extensions
AxisCube
Source
Systems
CubeMarkerSystem.h
1
#pragma once
2
3
#include "Systems/ComponentSystem.h"
4
5
#include "../Components/CubeMarkerComponent.h"
6
7
#include "Resources/Resources.h"
8
9
#include <unordered_map>
10
11
namespace
Cogs
12
{
13
namespace
Core
14
{
15
class
Context;
16
17
struct
CubeMarkerData
18
{
20
WeakEntityPtr
cube
;
21
WeakEntityPtr
centerMarkerShape;
22
WeakEntityPtr
wallMarkerShapes[3];
23
uint32_t colorKeys[3] = {};
24
};
25
26
class
CubeMarkerSystem
:
public
ComponentSystemWithDataPool
<CubeMarkerComponent, CubeMarkerData>
27
{
28
public
:
29
CubeMarkerSystem
(
Memory::Allocator
* allocator,
SizeType
capacity) :
ComponentSystemWithDataPool
(allocator, capacity) {}
30
31
void
update
(
Context
*
context
)
override
;
32
33
private
:
34
struct
WallMarkerMaterials
35
{
36
MaterialInstanceHandle
solid;
37
MaterialInstanceHandle
line;
38
};
39
40
std::unordered_map<uint32_t, WallMarkerMaterials> wallMarkerMaterials;
41
42
void
createCenterMarker(
CubeMarkerData
& cmapData,
CubeMarkerComponent
& cmapComp);
43
44
void
updateCenterMarker(
CubeMarkerData
& cubeMarkerData,
CubeMarkerComponent
& cubeMarkerComp,
bool
force);
45
46
void
destroyCenterMarker(
CubeMarkerData
& cmapData,
CubeMarkerComponent
& cmapComp);
47
48
void
createWallMarkers(
CubeMarkerData
& cmapData,
CubeMarkerComponent
& cmapComp);
49
50
void
updateWallMarkers(
CubeMarkerData
& cubeMarkerData,
CubeMarkerComponent
& cubeMarkerComp,
bool
force);
51
52
void
destroyWallMarkers(
CubeMarkerData
& cmapData,
CubeMarkerComponent
& cmapComp);
53
54
MeshHandle
createWallMarkerMesh(
Context
*
context
);
55
56
MaterialInstanceHandle
createUnshadedMaterialInstance(
Context
*
context
,
const
glm::vec4 color);
57
};
58
}
// namespace Core
59
}
// namespace Cogs
Cogs::Core::ComponentSystemBase::context
Context * context
Pointer to the Context instance the system lives in.
Definition:
ComponentSystem.h:136
Cogs::Core::ComponentSystemBase::update
void update()
Updates the system state to that of the current frame.
Definition:
ComponentSystem.h:65
Cogs::Core::ComponentSystemWithDataPool
Component system with parallel data per component stored in a pool similar to how the components them...
Definition:
ComponentSystem.h:365
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Core::CubeMarkerSystem
Definition:
CubeMarkerSystem.h:27
Cogs::Memory::Allocator
Base allocator implementation.
Definition:
Allocator.h:30
Cogs::Core::WeakEntityPtr
std::weak_ptr< ComponentModel::Entity > WeakEntityPtr
Weak Smart pointer for Entity access.
Definition:
EntityPtr.h:18
Cogs
Contains all Cogs related functionality.
Definition:
FieldSetter.h:23
Cogs::SizeType
ComponentIndex SizeType
Type used to track the size of pools.
Definition:
Component.h:19
Cogs::Core::CubeMarkerComponent
Definition:
CubeMarkerComponent.h:15
Cogs::Core::CubeMarkerData
Definition:
CubeMarkerSystem.h:18
Cogs::Core::CubeMarkerData::cube
WeakEntityPtr cube
Definition:
CubeMarkerSystem.h:20
Cogs::Core::CubeMarkerSystem::WallMarkerMaterials
Definition:
CubeMarkerSystem.h:35
Cogs::Core::ResourceHandle_t< MaterialInstance >
Generated by
1.9.6