OgreBlendMode.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 
00024 You may alternatively use this source under the terms of a specific version of
00025 the OGRE Unrestricted License provided you have obtained such a license from
00026 Torus Knot Software Ltd.
00027 -----------------------------------------------------------------------------
00028 */
00029 #ifndef __BLENDMODE_H__
00030 #define __BLENDMODE_H__
00031 
00032 #include "OgrePrerequisites.h"
00033 #include "OgreColourValue.h"
00034 
00035 namespace Ogre {
00036 
00039     enum LayerBlendType
00040     {
00041         LBT_COLOUR,
00042         LBT_ALPHA
00043     };
00044 
00052     enum LayerBlendOperation {
00054         LBO_REPLACE,
00056         LBO_ADD,
00058         LBO_MODULATE,
00060         LBO_ALPHA_BLEND
00061 
00062     };
00063 
00070     enum LayerBlendOperationEx {
00072         LBX_SOURCE1,
00074         LBX_SOURCE2,
00076         LBX_MODULATE,
00078         LBX_MODULATE_X2,
00080         LBX_MODULATE_X4,
00082         LBX_ADD,
00084         LBX_ADD_SIGNED,
00086         LBX_ADD_SMOOTH,
00088         LBX_SUBTRACT,
00090         LBX_BLEND_DIFFUSE_ALPHA,
00092         LBX_BLEND_TEXTURE_ALPHA,
00094         LBX_BLEND_CURRENT_ALPHA,
00096         LBX_BLEND_MANUAL,
00098         LBX_DOTPRODUCT,
00100         LBX_BLEND_DIFFUSE_COLOUR
00101     };
00102 
00107     enum LayerBlendSource
00108     {
00110         LBS_CURRENT,
00112         LBS_TEXTURE,
00114         LBS_DIFFUSE,
00116         LBS_SPECULAR,
00118         LBS_MANUAL
00119     };
00134     class _OgreExport LayerBlendModeEx
00135     {
00136     public:
00138         LayerBlendType blendType;
00140         LayerBlendOperationEx operation;
00142         LayerBlendSource source1;
00144         LayerBlendSource source2;
00145 
00147         ColourValue colourArg1;
00149         ColourValue colourArg2;
00151         Real alphaArg1;
00153         Real alphaArg2;
00155         Real factor;
00156 
00157         bool operator==(const LayerBlendModeEx& rhs) const
00158         {
00159             if (blendType != rhs.blendType) return false;
00160 
00161             if (blendType == LBT_COLOUR)
00162             {
00163 
00164                 if (operation == rhs.operation &&
00165                     source1 == rhs.source1 &&
00166                     source2 == rhs.source2 &&
00167                     colourArg1 == rhs.colourArg1 &&
00168                     colourArg2 == rhs.colourArg2 &&
00169                     factor == rhs.factor)
00170                 {
00171                     return true;
00172                 }
00173             }
00174             else // if (blendType == LBT_ALPHA)
00175             {
00176                 if (operation == rhs.operation &&
00177                     source1 == rhs.source1 &&
00178                     source2 == rhs.source2 &&
00179                     alphaArg1 == rhs.alphaArg1 &&
00180                     alphaArg2 == rhs.alphaArg2 &&
00181                     factor == rhs.factor)
00182                 {
00183                     return true;
00184                 }
00185             }
00186             return false;
00187         }
00188 
00189         bool operator!=(const LayerBlendModeEx& rhs) const
00190         {
00191             return !(*this == rhs);
00192         }
00193 
00194 
00195 
00196     };
00197 
00210     enum SceneBlendType
00211     {
00213         SBT_TRANSPARENT_ALPHA,
00215         SBT_TRANSPARENT_COLOUR,
00217         SBT_ADD,
00219         SBT_MODULATE,
00221         SBT_REPLACE
00222         // TODO : more
00223     };
00224 
00229     enum SceneBlendFactor
00230     {
00231         SBF_ONE,
00232         SBF_ZERO,
00233         SBF_DEST_COLOUR,
00234         SBF_SOURCE_COLOUR,
00235         SBF_ONE_MINUS_DEST_COLOUR,
00236         SBF_ONE_MINUS_SOURCE_COLOUR,
00237         SBF_DEST_ALPHA,
00238         SBF_SOURCE_ALPHA,
00239         SBF_ONE_MINUS_DEST_ALPHA,
00240         SBF_ONE_MINUS_SOURCE_ALPHA
00241 
00242     };
00243 }
00244 
00245 #endif

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:22 2009