1 | // author: Szabolcs Czuczor (BME-IIT)
|
---|
2 |
|
---|
3 | #include "PhotonMapFilteringRun.h"
|
---|
4 |
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * @brief: Constructor.
|
---|
8 | */
|
---|
9 | PhotonMapFilteringRun::PhotonMapFilteringRun(Entity* entity, const String& areaMapName, const String& unfilteredPhotonMapName)
|
---|
10 | {
|
---|
11 | this->entity = entity;
|
---|
12 | Root* mRoot=Root::getSingletonPtr();
|
---|
13 | this->areaMap = TextureManager::getSingleton().load(areaMapName,"PMFTEX");
|
---|
14 | this->unfilteredPhotonMap = TextureManager::getSingleton().load(unfilteredPhotonMapName,"PMFTEX");
|
---|
15 | this->normalMapPass=new PMFNormalMapPass(mRoot,1024,1024);
|
---|
16 | this->photonMapFilteringPass=new PMFFilteringPass(mRoot,1024,1024);
|
---|
17 | this->photonMapFilteringPass->changeTexture(areaMap->getName() , 0);
|
---|
18 | this->photonMapFilteringPass->changeTexture(unfilteredPhotonMap->getName() , 1);
|
---|
19 | this->photonMapFilteringPass->changeTexture(normalMapPass->getRenderTextureName() , 2);
|
---|
20 | this->normalMapPass->update();
|
---|
21 | this->photonMapFilteringPass->update();
|
---|
22 | }
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * @brief: Destructor.
|
---|
26 | */
|
---|
27 | PhotonMapFilteringRun::~PhotonMapFilteringRun()
|
---|
28 | {
|
---|
29 | delete normalMapPass;
|
---|
30 | delete photonMapFilteringPass;
|
---|
31 | }
|
---|
32 |
|
---|
33 | void PhotonMapFilteringRun::update()
|
---|
34 | {
|
---|
35 | this->normalMapPass->update();
|
---|
36 | this->photonMapFilteringPass->update();
|
---|
37 | }
|
---|
38 |
|
---|
39 | void PhotonMapFilteringRun::init(float areaCompensation, float normalThreshold)
|
---|
40 | {
|
---|
41 | if (areaCompensation >= 0.0) this->photonMapFilteringPass->setAreaCompensation(areaCompensation);
|
---|
42 | if (normalThreshold >= 0.0) this->photonMapFilteringPass->setNormalThreshold(normalThreshold);
|
---|
43 | }
|
---|
44 |
|
---|
45 | const String& PhotonMapFilteringRun::getResultTextureName()
|
---|
46 | {
|
---|
47 | return photonMapFilteringPass->getRenderTextureName();
|
---|
48 | }
|
---|
49 |
|
---|
50 |
|
---|
51 |
|
---|