1 | #include "Ogre.h"
|
---|
2 | #include "OgreEffectWrapper.h"
|
---|
3 | #include "managedogrerendertexturepass.h"
|
---|
4 | #include "DiffuseEnvironmentMapRun.h"
|
---|
5 |
|
---|
6 | DiffuseEnvironmentMapRun::DiffuseEnvironmentMapRun(Entity* entity, unsigned int resolution)
|
---|
7 | {
|
---|
8 | Root* mRoot=Root::getSingletonPtr();
|
---|
9 | OgreAssert(mRoot!=NULL,"Root is not yet generated, rendering will fail.");
|
---|
10 | envMapPass=new DEMEnvironmentMapPass(mRoot,resolution,resolution);
|
---|
11 | }
|
---|
12 |
|
---|
13 | DiffuseEnvironmentMapRun::~DiffuseEnvironmentMapRun(void)
|
---|
14 | {
|
---|
15 | delete envMapPass;
|
---|
16 | }
|
---|
17 |
|
---|
18 | void DiffuseEnvironmentMapRun::update(){
|
---|
19 | envMapPass->clearRenderTargets();
|
---|
20 | envMapPass->addRenderTarget(envMapPass->getRenderTexture(),CUBEMAP_FACE_POSITIVE_X);
|
---|
21 | envMapPass->update();
|
---|
22 | envMapPass->clearRenderTargets();
|
---|
23 | envMapPass->addRenderTarget(envMapPass->getRenderTexture(),CUBEMAP_FACE_POSITIVE_Y);
|
---|
24 | envMapPass->update();
|
---|
25 | envMapPass->clearRenderTargets();
|
---|
26 | envMapPass->addRenderTarget(envMapPass->getRenderTexture(),CUBEMAP_FACE_POSITIVE_Z);
|
---|
27 | envMapPass->update();
|
---|
28 | envMapPass->clearRenderTargets();
|
---|
29 | envMapPass->addRenderTarget(envMapPass->getRenderTexture(),CUBEMAP_FACE_NEGATIVE_X);
|
---|
30 | envMapPass->update();
|
---|
31 | envMapPass->clearRenderTargets();
|
---|
32 | envMapPass->addRenderTarget(envMapPass->getRenderTexture(),CUBEMAP_FACE_NEGATIVE_Y);
|
---|
33 | envMapPass->update();
|
---|
34 | envMapPass->clearRenderTargets();
|
---|
35 | envMapPass->addRenderTarget(envMapPass->getRenderTexture(),CUBEMAP_FACE_NEGATIVE_Z);
|
---|
36 | envMapPass->update();
|
---|
37 | } |
---|