*
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#ifndef PosteffectManager_h__
|
||||
#define PosteffectManager_h__
|
||||
#include <vector>
|
||||
#include "render/PostEffect.h"
|
||||
|
||||
namespace LifeGraphics
|
||||
{
|
||||
class PostEffectManager
|
||||
{
|
||||
private:
|
||||
std::vector<PostEffect*> postEffects;
|
||||
SceneDescriptor descriptor;
|
||||
public:
|
||||
PostEffectManager()
|
||||
{
|
||||
}
|
||||
~PostEffectManager()
|
||||
{
|
||||
}
|
||||
void Init(SceneDescriptor& desc)
|
||||
{
|
||||
descriptor = desc;
|
||||
}
|
||||
|
||||
void Add(PostEffect* effect)
|
||||
{
|
||||
postEffects.push_back(effect);
|
||||
}
|
||||
|
||||
ITexture2D* Execute(ITexture2D* source, ITexture2D* depth, ITexture2D* depthTex, float dt)
|
||||
{
|
||||
ITexture2D* tmpResult = (ITexture2D*)0;
|
||||
|
||||
for (UINT i = 0; i < postEffects.size(); i++)
|
||||
{
|
||||
PostEffectParams params;
|
||||
params.timeElapsed = dt;
|
||||
params.depthTarget = depth;
|
||||
params.depthTex = depthTex;
|
||||
|
||||
if (tmpResult)
|
||||
{
|
||||
params.renderTarget = tmpResult;
|
||||
tmpResult = postEffects[i]->Execute(params);
|
||||
}
|
||||
else
|
||||
{
|
||||
params.renderTarget = source;
|
||||
tmpResult = postEffects[i]->Execute(params);
|
||||
}
|
||||
}
|
||||
return tmpResult;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // PosteffectManager_h__
|
||||
Reference in New Issue
Block a user