Cogs.Core
TrajectoryCrossSectionsSystem.h
1#pragma once
2
3#include "Systems/ComponentSystem.h"
4#include "Resources/VertexFormats.h"
5
6#include "TrajectoryCrossSectionsComponent.h"
7
8#include "Foundation/Geometry/BoundingBox.hpp"
9
10namespace Cogs
11{
12 namespace Core
13 {
14 class Context;
15
17 {
18 Geometry::BoundingBox boundingBox;
19 Geometry::BoundingBox trajectoryBoundingBox;
20 float startMeasuredDepth = 0.f;
21 float stopMeasuredDepth = 1.f;
22 int index0 = 0;
23 int index1 = 0;
24 int rings = 0;
25 int samples = 0;
26 bool generate = false;
27 //std::vector<uint8_t> currInclude; ///< True for each index to include (size()=rings).
28 //std::vector<uint8_t> prevInclude; ///< Copy from previous iteration, used to determine if geometry must be regenerated.
29 };
30
32 : public ComponentSystemWithDataPool<TrajectoryCrossSectionsComponent, TrajectoryCrossSectionsData>
33 {
34 public:
35 TrajectoryCrossSectionsSystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
36
37 void update(Context* context);
38
39 private:
40 glm::vec2 currentViewport;
41 std::vector<glm::vec2> positionsScreen;
42 std::vector<glm::ivec2> ranges;
43 };
44 } // of namespace Core
45} // of namespace Cogs
Context * context
Pointer to the Context instance the system lives in.
void update()
Updates the system state to that of the current frame.
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
std::vector< glm::vec2 > positionsScreen
Temporary positions in window coordinates.
glm::vec2 currentViewport
Used to detect viewport changes.
std::vector< glm::ivec2 > ranges
Temporary set of ranges.
Base allocator implementation.
Definition: Allocator.h:30
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19
int samples
Number of perimeter samples used when cross sections were created.
bool generate
True if cross sections must be recalculated on next update.
Geometry::BoundingBox trajectoryBoundingBox
Model-space bounding box of the trajectory sub-section that we cover.
Geometry::BoundingBox boundingBox
Model-space bounding box of cross-section data.
int rings
Number of rings around trajectory in tessellation.