Project

General

Profile

SO3Engine
SO3CompositorTarget.cpp
Go to the documentation of this file.
1
5#include <boost/format.hpp>
8
9namespace SO3
10{
11
12SCompositorTarget::SCompositorTarget(SCompositorTechnique* technique, Ogre::CompositionTargetPass* ogreTargetPassRef, int targetId) : SData("")
13{
14 ogreCompositorTarget = ogreTargetPassRef;
15 parentTechnique = technique;
16 name = boost::str(boost::format("%1%") %targetId);
17
18 // Iterate through target passes
19 Ogre::CompositionTargetPass::Passes passList = ogreCompositorTarget->getPasses();
20 for (unsigned int p = 0; p < passList.size(); p++)
21 {
22 // Create SCompositorPass wrapper.
23 Ogre::CompositionPass* ogreCompositionPass = passList[p];
24 SCompositorPass* newCompositorPass = new SCompositorPass(this, ogreCompositionPass, compositorPassesByIndex.size());
25
26 // Store it.
27 compositorPassesIndexByName.insert(CompositorPassesIndexByName::value_type(newCompositorPass->GetName(), compositorPassesByIndex.size()));
28 compositorPassesByIndex.push_back(newCompositorPass);
29 }
30}
31
32SCompositorTarget::SCompositorTarget() : SData("")
33{
34 // Forbiden (private)
35}
36
38{
39 // Destroy SCompositorTarget wrappers.
40 CompositorPassesByIndex::iterator iCompositorPass = compositorPassesByIndex.begin();
41 while(iCompositorPass != compositorPassesByIndex.end())
42 {
43 delete(*iCompositorPass);
44 iCompositorPass++;
45 }
46 compositorPassesByIndex.clear();
47 compositorPassesIndexByName.clear();
48}
49
51{
52 return ogreCompositorTarget->getPasses().size();
53}
54
56{
57 if((pass >= 0)&&(pass < compositorPassesByIndex.size()))
58 return compositorPassesByIndex.at(pass);
59 else
60 return 0;
61}
62
64{
65 CompositorPassesIndexByName::iterator iSearchedCompositorPassIndex = compositorPassesIndexByName.find(passName);
66 if(iSearchedCompositorPassIndex!= compositorPassesIndexByName.end())
67 return iSearchedCompositorPassIndex->second;
68 else
69 return -1;
70}
71
72}
int GetCompositorPassIndexByName(const std::string &passName)
SCompositorPass * GetCompositorPass(const unsigned int &pass)
std::string GetName() const
std::string name
Definition SO3DataScol.h:44