Cogs.Core
EnvironmentSystem.h
1#pragma once
2
3#include "Components/Core/EnvironmentComponent.h"
4
5#include "Systems/ComponentSystem.h"
6
7namespace Cogs
8{
9 namespace Core
10 {
12 {
13 unsigned radianceLods = 0;
14 unsigned irradianceLods = 0;
15 unsigned ambientIrradianceLods = 0;
16 };
17
18 class EnvironmentSystem : public ComponentSystemWithDataPool<EnvironmentComponent, EnvironmentData>
19 {
20 public:
21 EnvironmentSystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
22
23 void update(Context * context);
24
26 void setGlobalEnvironment(ComponentModel::ComponentHandle environmentComponent) { globalEnvironment = environmentComponent; }
27
29 EnvironmentComponent * getGlobalEnvironment() const { return globalEnvironment ? globalEnvironment.resolveComponent<EnvironmentComponent>() : nullptr; }
30
31 private:
33 };
34 }
35}
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
void setGlobalEnvironment(ComponentModel::ComponentHandle environmentComponent)
Set the global environment component, used to control the default environment of the scene.
EnvironmentComponent * getGlobalEnvironment() const
Get the global environment component.
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
Handle to a Component instance.
Definition: Component.h:67
static ComponentHandle Empty()
Returns an empty, invalid handle. Will evaluate to false if tested against using operator bool().
Definition: Component.h:119
ComponentType * resolveComponent() const
Definition: Component.h:90