Cogs.Core
Source
Systems
Geometry
VariableExtrusionSystem.h
1
#pragma once
2
3
#include "Systems/ComponentSystem.h"
4
5
#include "Components/Geometry/VariableExtrusionComponent.h"
6
#include "Components/Core/MeshComponent.h"
7
8
#include "Resources/MeshManager.h"
9
10
namespace
Cogs
11
{
12
namespace
Core
13
{
14
class
Context;
15
16
struct
VariableExtrusionData
17
{
18
size_t
pathLength = 0;
19
glm::vec3 primaryAxis;
20
size_t
numSegments = 0;
21
bool
useTexture =
false
;
22
23
std::vector<glm::vec3> positions;
24
std::vector<glm::vec3> directions;
25
26
std::vector<float> offsetDepths;
27
28
std::vector<glm::quat> rotations;
29
30
std::vector<glm::vec3> crossSection;
31
std::vector<glm::vec3> morphCrossSection;
32
33
std::vector<int32_t> indexes;
34
35
std::vector<glm::vec2> textureCoordinates;
36
37
EntityPtr
sideShape;
38
};
39
40
class
VariableExtrusionSystem
:
public
ComponentSystemWithDataPool
<VariableExtrusionComponent, VariableExtrusionData>
41
{
42
public
:
43
VariableExtrusionSystem
(
Memory::Allocator
* allocator,
SizeType
capacity) :
ComponentSystemWithDataPool
(allocator, capacity) {}
44
45
void
update
(
Context
*
context
);
46
47
void
updatePath(
Context
*
context
,
const
VariableExtrusionComponent
& component);
48
void
updateSegmentCount(
Context
*
context
,
const
VariableExtrusionComponent
& component);
49
void
updateRotations(
Context
*
context
,
const
VariableExtrusionComponent
& component);
50
void
updateCrossSections(
Context
*
context
,
const
VariableExtrusionComponent
& component);
51
void
updateOffsets(
Context
*
context
,
const
VariableExtrusionComponent
& component);
52
void
updateTransformation(
Context
*
context
,
const
VariableExtrusionComponent
& component);
53
void
offsetCrossSections(
Context
*
context
,
const
VariableExtrusionComponent
& component);
54
void
updateTextureCoordinates(
Context
*
context
,
const
VariableExtrusionComponent
& component);
55
void
updateIndexes(
Context
*
context
,
const
VariableExtrusionComponent
& component);
56
void
updateSideShape(
Context
*
context
,
const
VariableExtrusionComponent
& component);
57
void
updateNormals(
Context
*
context
,
const
VariableExtrusionComponent
& component);
58
59
Mesh
* getMesh(
Context
*
context
,
const
VariableExtrusionComponent
& component);
60
};
61
}
62
}
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::VariableExtrusionSystem
Definition:
VariableExtrusionSystem.h:41
Cogs::Memory::Allocator
Base allocator implementation.
Definition:
Allocator.h:30
Cogs::Core::EntityPtr
std::shared_ptr< ComponentModel::Entity > EntityPtr
Smart pointer for Entity access.
Definition:
EntityPtr.h:12
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::Mesh
Meshes contain streams of vertex data in addition to index data and options defining geometry used fo...
Definition:
Mesh.h:265
Cogs::Core::VariableExtrusionComponent
Definition:
VariableExtrusionComponent.h:15
Cogs::Core::VariableExtrusionData
Definition:
VariableExtrusionSystem.h:17
Generated by
1.9.6