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-2012 Torus Knot Software Ltd
    00008
    00009 Permission is hereby granted, free of charge, to any person obtaining a copy
    00010 of this software and associated documentation files (the "Software"), to deal
    00011 in the Software without restriction, including without limitation the rights
    00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00013 copies of the Software, and to permit persons to whom the Software is
    00014 furnished to do so, subject to the following conditions:
    00015
    00016 The above copyright notice and this permission notice shall be included in
    00017 all copies or substantial portions of the Software.
    00018
    00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    00025 THE SOFTWARE.
    00026 -----------------------------------------------------------------------------
    00027 */
    00028 #ifndef __BLENDMODE_H__
    00029 #define __BLENDMODE_H__
    00030
    00031 #include "OgrePrerequisites.h"
    00032 #include "OgreColourValue.h"
    00033
    00034 namespace Ogre {
    00044     enum LayerBlendType
    00045     {
    00046         LBT_COLOUR,
    00047         LBT_ALPHA
    00048     };
    00049
    00057     enum LayerBlendOperation {
    00059         LBO_REPLACE,
    00061         LBO_ADD,
    00063         LBO_MODULATE,
    00065         LBO_ALPHA_BLEND
    00066
    00067     };
    00068
    00075     enum LayerBlendOperationEx {
    00077         LBX_SOURCE1,
    00079         LBX_SOURCE2,
    00081         LBX_MODULATE,
    00083         LBX_MODULATE_X2,
    00085         LBX_MODULATE_X4,
    00087         LBX_ADD,
    00089         LBX_ADD_SIGNED,
    00091         LBX_ADD_SMOOTH,
    00093         LBX_SUBTRACT,
    00095         LBX_BLEND_DIFFUSE_ALPHA,
    00097         LBX_BLEND_TEXTURE_ALPHA,
    00099         LBX_BLEND_CURRENT_ALPHA,
    00101         LBX_BLEND_MANUAL,
    00103         LBX_DOTPRODUCT,
    00105         LBX_BLEND_DIFFUSE_COLOUR
    00106     };
    00107
    00112     enum LayerBlendSource
    00113     {
    00115         LBS_CURRENT,
    00117         LBS_TEXTURE,
    00119         LBS_DIFFUSE,
    00121         LBS_SPECULAR,
    00123         LBS_MANUAL
    00124     };
    00139     class _OgreExport LayerBlendModeEx
    00140     {
    00141     public:
    00143         LayerBlendType blendType;
    00145         LayerBlendOperationEx operation;
    00147         LayerBlendSource source1;
    00149         LayerBlendSource source2;
    00150
    00152         ColourValue colourArg1;
    00154         ColourValue colourArg2;
    00156         Real alphaArg1;
    00158         Real alphaArg2;
    00160         Real factor;
    00161
    00162         bool operator==(const LayerBlendModeEx& rhs) const
    00163         {
    00164             if (blendType != rhs.blendType) return false;
    00165
    00166             if (blendType == LBT_COLOUR)
    00167             {
    00168
    00169                 if (operation == rhs.operation &&
    00170                     source1 == rhs.source1 &&
    00171                     source2 == rhs.source2 &&
    00172                     colourArg1 == rhs.colourArg1 &&
    00173                     colourArg2 == rhs.colourArg2 &&
    00174                     factor == rhs.factor)
    00175                 {
    00176                     return true;
    00177                 }
    00178             }
    00179             else // if (blendType == LBT_ALPHA)
    00180             {
    00181                 if (operation == rhs.operation &&
    00182                     source1 == rhs.source1 &&
    00183                     source2 == rhs.source2 &&
    00184                     alphaArg1 == rhs.alphaArg1 &&
    00185                     alphaArg2 == rhs.alphaArg2 &&
    00186                     factor == rhs.factor)
    00187                 {
    00188                     return true;
    00189                 }
    00190             }
    00191             return false;
    00192         }
    00193
    00194         bool operator!=(const LayerBlendModeEx& rhs) const
    00195         {
    00196             return !(*this == rhs);
    00197         }
    00198
    00199
    00200
    00201     };
    00202
    00215     enum SceneBlendType
    00216     {
    00218         SBT_TRANSPARENT_ALPHA,
    00220         SBT_TRANSPARENT_COLOUR,
    00222         SBT_ADD,
    00224         SBT_MODULATE,
    00226         SBT_REPLACE
    00227         // TODO : more
    00228     };
    00229
    00234     enum SceneBlendFactor
    00235     {
    00236         SBF_ONE,
    00237         SBF_ZERO,
    00238         SBF_DEST_COLOUR,
    00239         SBF_SOURCE_COLOUR,
    00240         SBF_ONE_MINUS_DEST_COLOUR,
    00241         SBF_ONE_MINUS_SOURCE_COLOUR,
    00242         SBF_DEST_ALPHA,
    00243         SBF_SOURCE_ALPHA,
    00244         SBF_ONE_MINUS_DEST_ALPHA,
    00245         SBF_ONE_MINUS_SOURCE_ALPHA
    00246
    00247     };
    00248
    00253     enum SceneBlendOperation
    00254     {
    00255         SBO_ADD,
    00256         SBO_SUBTRACT,
    00257         SBO_REVERSE_SUBTRACT,
    00258         SBO_MIN,
    00259         SBO_MAX
    00260     };
    00264 }
    00265
    00266 #endif

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:20