[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 "OgreCompositionPass.h"
|
---|
| 27 | #include "OgreMaterialManager.h"
|
---|
| 28 |
|
---|
| 29 | namespace Ogre {
|
---|
| 30 |
|
---|
| 31 | CompositionPass::CompositionPass(CompositionTargetPass *parent):
|
---|
| 32 | mParent(parent),
|
---|
| 33 | mType(PT_RENDERQUAD),
|
---|
| 34 | mIdentifier(0),
|
---|
| 35 | mFirstRenderQueue(RENDER_QUEUE_SKIES_EARLY),
|
---|
| 36 | mLastRenderQueue(RENDER_QUEUE_SKIES_LATE),
|
---|
| 37 | mClearBuffers(FBT_COLOUR|FBT_DEPTH),
|
---|
| 38 | mClearColour(0.0,0.0,0.0,0.0),
|
---|
| 39 | mClearDepth(1.0f),
|
---|
| 40 | mClearStencil(0),
|
---|
| 41 | mStencilCheck(false),
|
---|
| 42 | mStencilFunc(CMPF_ALWAYS_PASS),
|
---|
| 43 | mStencilRefValue(0),
|
---|
| 44 | mStencilMask(0xFFFFFFFF),
|
---|
| 45 | mStencilFailOp(SOP_KEEP),
|
---|
| 46 | mStencilDepthFailOp(SOP_KEEP),
|
---|
| 47 | mStencilPassOp(SOP_KEEP),
|
---|
| 48 | mStencilTwoSidedOperation(false)
|
---|
| 49 | {
|
---|
| 50 | }
|
---|
| 51 | //-----------------------------------------------------------------------
|
---|
| 52 | CompositionPass::~CompositionPass()
|
---|
| 53 | {
|
---|
| 54 | }
|
---|
| 55 | //-----------------------------------------------------------------------
|
---|
| 56 | void CompositionPass::setType(CompositionPass::PassType type)
|
---|
| 57 | {
|
---|
| 58 | mType = type;
|
---|
| 59 | }
|
---|
| 60 | //-----------------------------------------------------------------------
|
---|
| 61 | CompositionPass::PassType CompositionPass::getType() const
|
---|
| 62 | {
|
---|
| 63 | return mType;
|
---|
| 64 | }
|
---|
| 65 | //-----------------------------------------------------------------------
|
---|
| 66 | void CompositionPass::setIdentifier(uint32 id)
|
---|
| 67 | {
|
---|
| 68 | mIdentifier = id;
|
---|
| 69 | }
|
---|
| 70 | //-----------------------------------------------------------------------
|
---|
| 71 | uint32 CompositionPass::getIdentifier() const
|
---|
| 72 | {
|
---|
| 73 | return mIdentifier;
|
---|
| 74 | }
|
---|
| 75 | //-----------------------------------------------------------------------
|
---|
| 76 | void CompositionPass::setMaterial(MaterialPtr mat)
|
---|
| 77 | {
|
---|
| 78 | mMaterial = mat;
|
---|
| 79 | }
|
---|
| 80 | //-----------------------------------------------------------------------
|
---|
| 81 | void CompositionPass::setMaterialName(const String &name)
|
---|
| 82 | {
|
---|
| 83 | mMaterial = MaterialManager::getSingleton().getByName(name);
|
---|
| 84 | }
|
---|
| 85 | //-----------------------------------------------------------------------
|
---|
| 86 | MaterialPtr CompositionPass::getMaterial() const
|
---|
| 87 | {
|
---|
| 88 | return mMaterial;
|
---|
| 89 | }
|
---|
| 90 | //-----------------------------------------------------------------------
|
---|
| 91 | void CompositionPass::setClearBuffers(uint32 val)
|
---|
| 92 | {
|
---|
| 93 | mClearBuffers = val;
|
---|
| 94 | }
|
---|
| 95 | //-----------------------------------------------------------------------
|
---|
| 96 | uint32 CompositionPass::getClearBuffers()
|
---|
| 97 | {
|
---|
| 98 | return mClearBuffers;
|
---|
| 99 | }
|
---|
| 100 | //-----------------------------------------------------------------------
|
---|
| 101 | void CompositionPass::setClearColour(ColourValue val)
|
---|
| 102 | {
|
---|
| 103 | mClearColour = val;
|
---|
| 104 | }
|
---|
| 105 | //-----------------------------------------------------------------------
|
---|
| 106 | const ColourValue &CompositionPass::getClearColour()
|
---|
| 107 | {
|
---|
| 108 | return mClearColour;
|
---|
| 109 | }
|
---|
| 110 | //-----------------------------------------------------------------------
|
---|
| 111 | void CompositionPass::setInput(size_t id, const String &input)
|
---|
| 112 | {
|
---|
| 113 | assert(id<OGRE_MAX_TEXTURE_LAYERS);
|
---|
| 114 | mInputs[id] = input;
|
---|
| 115 | }
|
---|
| 116 | //-----------------------------------------------------------------------
|
---|
| 117 | const String &CompositionPass::getInput(size_t id)
|
---|
| 118 | {
|
---|
| 119 | assert(id<OGRE_MAX_TEXTURE_LAYERS);
|
---|
| 120 | return mInputs[id];
|
---|
| 121 | }
|
---|
| 122 | //-----------------------------------------------------------------------
|
---|
| 123 | size_t CompositionPass::getNumInputs()
|
---|
| 124 | {
|
---|
| 125 | size_t count = 0;
|
---|
| 126 | for(size_t x=0; x<OGRE_MAX_TEXTURE_LAYERS; ++x)
|
---|
| 127 | {
|
---|
| 128 | if(!mInputs[x].empty())
|
---|
| 129 | count = x+1;
|
---|
| 130 | }
|
---|
| 131 | return count;
|
---|
| 132 | }
|
---|
| 133 | //-----------------------------------------------------------------------
|
---|
| 134 | void CompositionPass::clearAllInputs()
|
---|
| 135 | {
|
---|
| 136 | for(size_t x=0; x<OGRE_MAX_TEXTURE_LAYERS; ++x)
|
---|
| 137 | {
|
---|
| 138 | mInputs[x].clear();
|
---|
| 139 | }
|
---|
| 140 | }
|
---|
| 141 | //-----------------------------------------------------------------------
|
---|
| 142 | CompositionTargetPass *CompositionPass::getParent()
|
---|
| 143 | {
|
---|
| 144 | return mParent;
|
---|
| 145 | }
|
---|
| 146 | //-----------------------------------------------------------------------
|
---|
| 147 | void CompositionPass::setFirstRenderQueue(uint8 id)
|
---|
| 148 | {
|
---|
| 149 | mFirstRenderQueue = id;
|
---|
| 150 | }
|
---|
| 151 | //-----------------------------------------------------------------------
|
---|
| 152 | uint8 CompositionPass::getFirstRenderQueue()
|
---|
| 153 | {
|
---|
| 154 | return mFirstRenderQueue;
|
---|
| 155 | }
|
---|
| 156 | //-----------------------------------------------------------------------
|
---|
| 157 | void CompositionPass::setLastRenderQueue(uint8 id)
|
---|
| 158 | {
|
---|
| 159 | mLastRenderQueue = id;
|
---|
| 160 | }
|
---|
| 161 | //-----------------------------------------------------------------------
|
---|
| 162 | uint8 CompositionPass::getLastRenderQueue()
|
---|
| 163 | {
|
---|
| 164 | return mLastRenderQueue;
|
---|
| 165 | }
|
---|
| 166 | //-----------------------------------------------------------------------
|
---|
| 167 | void CompositionPass::setClearDepth(Real depth)
|
---|
| 168 | {
|
---|
| 169 | mClearDepth = depth;
|
---|
| 170 | }
|
---|
| 171 | Real CompositionPass::getClearDepth()
|
---|
| 172 | {
|
---|
| 173 | return mClearDepth;
|
---|
| 174 | }
|
---|
| 175 | void CompositionPass::setClearStencil(uint32 value)
|
---|
| 176 | {
|
---|
| 177 | mClearStencil = value;
|
---|
| 178 | }
|
---|
| 179 | uint32 CompositionPass::getClearStencil()
|
---|
| 180 | {
|
---|
| 181 | return mClearStencil;
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | void CompositionPass::setStencilCheck(bool value)
|
---|
| 185 | {
|
---|
| 186 | mStencilCheck = value;
|
---|
| 187 | }
|
---|
| 188 | bool CompositionPass::getStencilCheck()
|
---|
| 189 | {
|
---|
| 190 | return mStencilCheck;
|
---|
| 191 | }
|
---|
| 192 | void CompositionPass::setStencilFunc(CompareFunction value)
|
---|
| 193 | {
|
---|
| 194 | mStencilFunc = value;
|
---|
| 195 | }
|
---|
| 196 | CompareFunction CompositionPass::getStencilFunc()
|
---|
| 197 | {
|
---|
| 198 | return mStencilFunc;
|
---|
| 199 | }
|
---|
| 200 | void CompositionPass::setStencilRefValue(uint32 value)
|
---|
| 201 | {
|
---|
| 202 | mStencilRefValue = value;
|
---|
| 203 | }
|
---|
| 204 | uint32 CompositionPass::getStencilRefValue()
|
---|
| 205 | {
|
---|
| 206 | return mStencilRefValue;
|
---|
| 207 | }
|
---|
| 208 | void CompositionPass::setStencilMask(uint32 value)
|
---|
| 209 | {
|
---|
| 210 | mStencilMask = value;
|
---|
| 211 | }
|
---|
| 212 | uint32 CompositionPass::getStencilMask()
|
---|
| 213 | {
|
---|
| 214 | return mStencilMask;
|
---|
| 215 | }
|
---|
| 216 | void CompositionPass::setStencilFailOp(StencilOperation value)
|
---|
| 217 | {
|
---|
| 218 | mStencilFailOp = value;
|
---|
| 219 | }
|
---|
| 220 | StencilOperation CompositionPass::getStencilFailOp()
|
---|
| 221 | {
|
---|
| 222 | return mStencilFailOp;
|
---|
| 223 | }
|
---|
| 224 | void CompositionPass::setStencilDepthFailOp(StencilOperation value)
|
---|
| 225 | {
|
---|
| 226 | mStencilDepthFailOp = value;
|
---|
| 227 | }
|
---|
| 228 | StencilOperation CompositionPass::getStencilDepthFailOp()
|
---|
| 229 | {
|
---|
| 230 | return mStencilDepthFailOp;
|
---|
| 231 | }
|
---|
| 232 | void CompositionPass::setStencilPassOp(StencilOperation value)
|
---|
| 233 | {
|
---|
| 234 | mStencilPassOp = value;
|
---|
| 235 | }
|
---|
| 236 | StencilOperation CompositionPass::getStencilPassOp()
|
---|
| 237 | {
|
---|
| 238 | return mStencilPassOp;
|
---|
| 239 | }
|
---|
| 240 | void CompositionPass::setStencilTwoSidedOperation(bool value)
|
---|
| 241 | {
|
---|
| 242 | mStencilTwoSidedOperation = value;
|
---|
| 243 | }
|
---|
| 244 | bool CompositionPass::getStencilTwoSidedOperation()
|
---|
| 245 | {
|
---|
| 246 | return mStencilTwoSidedOperation;
|
---|
| 247 | }
|
---|
| 248 |
|
---|
| 249 | }
|
---|