Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/OgreMain/src/OgreCompositionTargetPass.cpp @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 6.0 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#include "OgreStableHeaders.h"
30#include "OgreCompositionTargetPass.h"
31#include "OgreCompositionPass.h"
32#include "OgreMaterialManager.h"
33
34namespace Ogre {
35
36CompositionTargetPass::CompositionTargetPass(CompositionTechnique *parent):
37    mParent(parent),
38    mInputMode(IM_NONE),
39    mOnlyInitial(false),
40    mVisibilityMask(0xFFFFFFFF),
41    mLodBias(1.0f),
42        mMaterialScheme(MaterialManager::DEFAULT_SCHEME_NAME), 
43        mShadowsEnabled(true)
44{
45}
46//-----------------------------------------------------------------------
47CompositionTargetPass::~CompositionTargetPass()
48{
49    removeAllPasses();
50}
51//-----------------------------------------------------------------------
52void CompositionTargetPass::setInputMode(InputMode mode)
53{
54    mInputMode = mode;
55}
56//-----------------------------------------------------------------------
57CompositionTargetPass::InputMode CompositionTargetPass::getInputMode() const
58{
59    return mInputMode;
60}
61//-----------------------------------------------------------------------
62void CompositionTargetPass::setOutputName(const String &out)
63{
64    mOutputName = out;
65}
66//-----------------------------------------------------------------------
67const String &CompositionTargetPass::getOutputName() const
68{
69    return mOutputName;
70}
71//-----------------------------------------------------------------------
72void CompositionTargetPass::setOnlyInitial(bool value)
73{
74    mOnlyInitial = value;
75}
76//-----------------------------------------------------------------------
77bool CompositionTargetPass::getOnlyInitial()
78{
79    return mOnlyInitial;
80}
81//-----------------------------------------------------------------------
82void CompositionTargetPass::setVisibilityMask(uint32 mask)
83{
84    mVisibilityMask = mask;
85}
86//-----------------------------------------------------------------------
87uint32 CompositionTargetPass::getVisibilityMask()
88{
89    return mVisibilityMask;
90}
91//-----------------------------------------------------------------------
92void CompositionTargetPass::setLodBias(float bias)
93{
94    mLodBias = bias;
95}
96//-----------------------------------------------------------------------
97float CompositionTargetPass::getLodBias()
98{
99    return mLodBias;
100}
101//-----------------------------------------------------------------------
102void CompositionTargetPass::setMaterialScheme(const String& schemeName)
103{
104        mMaterialScheme = schemeName;
105}
106//-----------------------------------------------------------------------
107const String& CompositionTargetPass::getMaterialScheme(void) const
108{
109        return mMaterialScheme;
110}
111//-----------------------------------------------------------------------
112void CompositionTargetPass::setShadowsEnabled(bool enabled)
113{
114        mShadowsEnabled = enabled;
115}
116//-----------------------------------------------------------------------
117bool CompositionTargetPass::getShadowsEnabled(void) const
118{
119        return mShadowsEnabled;
120}
121//-----------------------------------------------------------------------
122CompositionPass *CompositionTargetPass::createPass()
123{
124    CompositionPass *t = new CompositionPass(this);
125    mPasses.push_back(t);
126    return t;
127}
128//-----------------------------------------------------------------------
129
130void CompositionTargetPass::removePass(size_t index)
131{
132    assert (index < mPasses.size() && "Index out of bounds.");
133    Passes::iterator i = mPasses.begin() + index;
134    delete(*i);
135    mPasses.erase(i);
136}
137//-----------------------------------------------------------------------
138
139CompositionPass *CompositionTargetPass::getPass(size_t index)
140{
141    assert (index < mPasses.size() && "Index out of bounds.");
142    return mPasses[index];
143}
144//-----------------------------------------------------------------------
145
146size_t CompositionTargetPass::getNumPasses()
147{
148    return mPasses.size();
149}
150//-----------------------------------------------------------------------
151void CompositionTargetPass::removeAllPasses()
152{
153    Passes::iterator i, iend;
154    iend = mPasses.end();
155    for (i = mPasses.begin(); i != iend; ++i)
156    {
157        delete(*i);
158    }
159    mPasses.clear();
160}
161//-----------------------------------------------------------------------
162CompositionTargetPass::PassIterator CompositionTargetPass::getPassIterator(void)
163{
164    return PassIterator(mPasses.begin(), mPasses.end());
165}
166
167//-----------------------------------------------------------------------
168CompositionTechnique *CompositionTargetPass::getParent()
169{
170    return mParent;
171}
172
173//-----------------------------------------------------------------------
174bool CompositionTargetPass::_isSupported(void)
175{
176    // A target pass is supported if all passes are supported
177
178    PassIterator passi = getPassIterator();
179    while (passi.hasMoreElements())
180    {
181        CompositionPass* pass = passi.getNext();
182        if (!pass->_isSupported())
183        {
184            return false;
185        }
186    }
187
188    return true;
189}
190
191}
Note: See TracBrowser for help on using the repository browser.