Cogs.Core
EffectManager.h
1#pragma once
2
3#include "ResourceManager.h"
4
5#include "Rendering/IEffects.h"
6
7#include "Effect.h"
8#include "EffectDefinition.h"
9
10namespace Cogs
11{
12 class IGraphicsDevice;
13
14 namespace Core
15 {
20 {
23
25 std::vector<std::string> dependencies;
26
28 bool preloading = false;
29 };
30
34 class EffectManager : public ResourceManager<Effect, EffectLoadInfo>
35 {
36 public:
38 EffectManager(Context * context) : ResourceManager(context) {}
39
42
44 void initialize() override;
45
55 EffectHandle loadEffect(const EffectDefinition & definition);
56
58 void handleLoad(EffectLoadInfo * loadInfo) override;
59
60 void handleReload(ResourceHandleBase handle) override;
61
63 ActivationResult handleActivation(EffectHandle handle, Effect * effect) override;
64
66 void handleDeletion(Effect * resource) override;
67
69 std::string extension;
70
72 std::string prefix;
73 };
74 }
75}
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Effect manager responsible for loading, processing and activating Effect resources.
Definition: EffectManager.h:35
void handleLoad(EffectLoadInfo *loadInfo) override
Overridden to handle effect loading.
ActivationResult handleActivation(EffectHandle handle, Effect *effect) override
Overridden to handle effect activation, updating the effect in the renderer.
void initialize() override
Initialize the effect manager.
std::string prefix
Prefix used to look up shader files.
Definition: EffectManager.h:72
EffectHandle loadEffect(const EffectDefinition &definition)
Load the effect described by the given definition.
std::string extension
Extension used to lookup shader files.
Definition: EffectManager.h:69
EffectManager(Context *context)
Constructs an EffectManager in the given context.
Definition: EffectManager.h:38
~EffectManager()
Destructs the EffectManager.
void handleDeletion(Effect *resource) override
Overridden to handle deletion, removing the effect resource from the renderer.
The generic resource manager provides a base implementation for specialized resource managers to buil...
ActivationResult
Defines results for resource activation.
Definition: ResourceBase.h:14
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Defines a loadable effect.
Load information for Effect resources.
Definition: EffectManager.h:20
std::vector< std::string > dependencies
Paths to all dependencies that need to be resident before activating the effect.
Definition: EffectManager.h:25
EffectDefinition definition
Definition of the effect and its dependencies.
Definition: EffectManager.h:22
bool preloading
If the effect is currently in the preloading phase, still resolving dependencies.
Definition: EffectManager.h:28
Effect resources contain data to control the shader stages of the GPU pipeline.
Definition: Effect.h:24
Resource handle base class handling reference counting of resources derived from ResourceBase.