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