Project

General

Profile

SO3Engine
SO3CompositorTechnique.cpp
Go to the documentation of this file.
1
5#include <boost/format.hpp>
8
9namespace SO3
10{
11
12SCompositorTechnique::SCompositorTechnique(SCompositor* compositor, Ogre::CompositionTechnique* ogreCompositionTechniqueRef, int techId) : SData("")
13{
14 ogreCompositorTechnique = ogreCompositionTechniqueRef;
15 parentCompositor = compositor;
16 name = boost::str(boost::format("%1%") %techId);
17
18 // Iterate through target passes
19 Ogre::CompositionTechnique::TargetPasses passList = ogreCompositorTechnique->getTargetPasses();
20 for (unsigned int p = 0; p < passList.size(); p++)
21 {
22 // Create SCompositorPass wrapper.
23 Ogre::CompositionTargetPass* ogreCompositionTargetPass = passList[p];
24 SCompositorTarget* newCompositorTarget = new SCompositorTarget(this, ogreCompositionTargetPass, compositorTargetsByIndex.size());
25
26 // Store it.
27 compositorTargetsIndexByName.insert(CompositorTargetsIndexByName::value_type(newCompositorTarget->GetName(), compositorTargetsByIndex.size()));
28 compositorTargetsByIndex.push_back(newCompositorTarget);
29 }
30}
31
32SCompositorTechnique::SCompositorTechnique() : SData("")
33{
34 // Forbiden (private)
35}
36
38{
39 // Destroy SCompositorTarget wrappers.
40 CompositorTargetsByIndex::iterator iCompositorTarget = compositorTargetsByIndex.begin();
41 while(iCompositorTarget != compositorTargetsByIndex.end())
42 {
43 delete(*iCompositorTarget);
44 iCompositorTarget++;
45 }
46 compositorTargetsByIndex.clear();
47 compositorTargetsIndexByName.clear();
48}
49
51{
52 return ogreCompositorTechnique;
53}
54
56{
57 return parentCompositor;
58}
59
61{
62 return ogreCompositorTechnique->getTargetPasses().size();
63}
64
66{
67 if((target >= 0) && (target < compositorTargetsByIndex.size()))
68 return compositorTargetsByIndex.at(target);
69 else
70 return 0;
71}
72
74{
75 CompositorTargetsIndexByName::iterator iSearchedCompositorTargetIndex = compositorTargetsIndexByName.find(targetName);
76 if(iSearchedCompositorTargetIndex!= compositorTargetsIndexByName.end())
77 return iSearchedCompositorTargetIndex->second;
78 else
79 return -1;
80}
81
82}
int GetCompositorTargetIndexByName(const std::string &targetName)
Ogre::CompositionTechnique * GetOgreCompositionTechniquePointer()
SCompositorTarget * GetCompositorTarget(const unsigned int &target)
std::string GetName() const
std::string name
Definition SO3DataScol.h:44