3#include "Systems/ComponentSystem.h"
4#include "Components/Core/SubMeshRenderComponent.h"
5#include "Services/TaskManager.h"
6#include "Scene/RayPick.h"
8#include "Foundation/Geometry/BoundingBox.hpp"
13 class SubMeshRenderSystem;
17 glm::mat4 localToWorld;
19 uint16_t localBoundsGeneration = 0;
20 uint16_t worldBoundsGeneration = 0;
21 uint8_t meshBoundsGeneration = 0;
23 uint32_t cullingIndex = (uint32_t)-1;
47 const glm::mat4& worldPickMatrix,
48 const glm::mat4& rawViewProjection,
49 const glm::mat4& viewMatrix,
53 std::vector<RayPicking::RayPickHit>& hits)
override;
75 TaskId getTaskGroup()
const {
return geometryGroup; }
79 return this->getData<SubMeshLocalBounds>(component);
84 return this->getData<SubMeshWorldBounds>(component);
87 void setBounds(
const SubMeshRenderComponent * component, Geometry::BoundingBox & box,
const glm::mat4 & worldTransform)
89 getWorldBounds(component) = box;
90 auto & data = getData<SubMeshRenderData>(component);
91 data.localToWorld = worldTransform;
98 bool needsPost =
true;
99 TaskId geometryGroup = NoTask;
101 std::unique_ptr<SubMeshPicker> picker;
Context * context
Pointer to the Context instance the system lives in.
void postUpdate()
Perform post update logic in the system.
void update()
Updates the system state to that of the current frame.
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 class for picking meshes.
Renders a mesh with flexible submesh usage.
The submesh render system handles SubMeshRenderComponents.
void initialize(Context *context) override
Initialize the system.
void destroyComponent(ComponentHandle component) override
Destroy the component held by the given handle.
void cleanup(Context *context) override
Provided for custom cleanup logic in derived systems.
ComponentHandle createComponent() override
Create a new component instance.
Base allocator implementation.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
PicksReturned
* Options for returning picking hits.
PickingFlags
Options for COGS picking.
ComponentIndex SizeType
Type used to track the size of pools.
Handle to a Component instance.
static ComponentHandle Empty()
Returns an empty, invalid handle. Will evaluate to false if tested against using operator bool().
bool pickImpl(Context *context, const glm::mat4 &worldPickMatrix, const glm::mat4 &rawViewProjection, const glm::mat4 &viewMatrix, const RayPicking::RayPickFilter &filter, PickingFlags pickingFlags, PicksReturned returnFlag, std::vector< RayPicking::RayPickHit > &hits) override
Each mesh rendering system should implement this function that goes through all components and calls ...
Task id struct used to identify unique Task instances.