1 | #include "Ogre.h"
|
---|
2 | #include "OgreEffectWrapper.h"
|
---|
3 | #include "managedogrerendertexturepass.h"
|
---|
4 | #include "SEMFinalRenderingRun.h"
|
---|
5 |
|
---|
6 | SEMFinalRenderingRun::SEMFinalRenderingRun(Entity* entity,RenderTarget* backBuffer,const String& textureName)
|
---|
7 | {
|
---|
8 |
|
---|
9 | Root* mRoot=Root::getSingletonPtr();
|
---|
10 | OgreAssert(mRoot!=NULL,"Root is not yet generated, rendering will fail.");
|
---|
11 | this->entity=entity;
|
---|
12 | this->backBuffer=backBuffer;
|
---|
13 | semFinalRenderingRunPass=new SEMFinalRenderingRunPass(mRoot);
|
---|
14 | semFinalRenderingRunPass->addRenderTarget(backBuffer);
|
---|
15 | semFinalRenderingRunPass->changeTexture(textureName,0);
|
---|
16 | }
|
---|
17 |
|
---|
18 | void SEMFinalRenderingRun::setEnvMapPostition(Vector3 envMapPosition){
|
---|
19 | semFinalRenderingRunPass->setEnvMapPostition(envMapPostion);
|
---|
20 | }
|
---|
21 |
|
---|
22 | void SEMFinalRenderingRun::setSpecularColor(float specularColor){
|
---|
23 | semFinalRenderingRunPass->setSpecularColor(specularColor);
|
---|
24 | }
|
---|
25 |
|
---|
26 | void SEMFinalRenderingRun::setShininess(float shininess){
|
---|
27 | semFinalRenderingRunPass->setShininess(shininess);
|
---|
28 | }
|
---|
29 |
|
---|
30 | SEMFinalRenderingRun::~SEMFinalRenderingRun(void)
|
---|
31 | {
|
---|
32 | }
|
---|
33 |
|
---|
34 | void SEMFinalRenderingRun::update(void){
|
---|
35 | if(entity->isVisible()){
|
---|
36 | SceneManager::EntityIterator entityIterator=mSceneMgr->getEntityIterator();
|
---|
37 | while(entityIterator.hasMoreElements()){
|
---|
38 | Entity* entityTemp=entityIterator.getNext();
|
---|
39 | entityVisibilityList.push_back(entityTemp->isVisible());
|
---|
40 | entityTemp->setVisible(false);
|
---|
41 | }
|
---|
42 | entity->setVisible(true);
|
---|
43 |
|
---|
44 | semFinalRenderingRunPass->update();
|
---|
45 |
|
---|
46 | SceneManager::EntityIterator entityIterator=mSceneMgr->getEntityIterator();
|
---|
47 | int elementNumber=0;
|
---|
48 | while(entityIterator.hasMoreElements()){
|
---|
49 | Entity* entity=entityIterator.getNext();
|
---|
50 | entity->setVisible(entityVisibilityList.at(elementNumber));
|
---|
51 | elementNumber++;
|
---|
52 | }
|
---|
53 | entityVisibilityList.clear();
|
---|
54 | }
|
---|
55 | } |
---|