OgreBlendMode.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __BLENDMODE_H__
#define __BLENDMODE_H__
#include "OgrePrerequisites.h"
#include "OgreColourValue.h"
namespace Ogre {
enum LayerBlendType
{
LBT_COLOUR,
LBT_ALPHA
};
enum LayerBlendOperation {
LBO_REPLACE,
LBO_ADD,
LBO_MODULATE,
LBO_ALPHA_BLEND
};
enum LayerBlendOperationEx {
LBX_SOURCE1,
LBX_SOURCE2,
LBX_MODULATE,
LBX_MODULATE_X2,
LBX_MODULATE_X4,
LBX_ADD,
LBX_ADD_SIGNED,
LBX_ADD_SMOOTH,
LBX_SUBTRACT,
LBX_BLEND_DIFFUSE_ALPHA,
LBX_BLEND_TEXTURE_ALPHA,
LBX_BLEND_CURRENT_ALPHA,
LBX_BLEND_MANUAL,
LBX_DOTPRODUCT,
LBX_BLEND_DIFFUSE_COLOUR
};
enum LayerBlendSource
{
LBS_CURRENT,
LBS_TEXTURE,
LBS_DIFFUSE,
LBS_SPECULAR,
LBS_MANUAL
};
class _OgreExport LayerBlendModeEx
{
public:
LayerBlendType blendType;
LayerBlendOperationEx operation;
LayerBlendSource source1;
LayerBlendSource source2;
ColourValue colourArg1;
ColourValue colourArg2;
Real alphaArg1;
Real alphaArg2;
Real factor;
bool operator==(const LayerBlendModeEx& rhs) const
{
if (blendType != rhs.blendType) return false;
if (blendType == LBT_COLOUR)
{
if (operation == rhs.operation &&
source1 == rhs.source1 &&
source2 == rhs.source2 &&
colourArg1 == rhs.colourArg1 &&
colourArg2 == rhs.colourArg2 &&
factor == rhs.factor)
{
return true;
}
}
else // if (blendType == LBT_ALPHA)
{
if (operation == rhs.operation &&
source1 == rhs.source1 &&
source2 == rhs.source2 &&
alphaArg1 == rhs.alphaArg1 &&
alphaArg2 == rhs.alphaArg2 &&
factor == rhs.factor)
{
return true;
}
}
return false;
}
bool operator!=(const LayerBlendModeEx& rhs) const
{
return !(*this == rhs);
}
};
enum SceneBlendType
{
SBT_TRANSPARENT_ALPHA,
SBT_TRANSPARENT_COLOUR,
SBT_ADD,
SBT_MODULATE,
SBT_REPLACE
// TODO : more
};
enum SceneBlendFactor
{
SBF_ONE,
SBF_ZERO,
SBF_DEST_COLOUR,
SBF_SOURCE_COLOUR,
SBF_ONE_MINUS_DEST_COLOUR,
SBF_ONE_MINUS_SOURCE_COLOUR,
SBF_DEST_ALPHA,
SBF_SOURCE_ALPHA,
SBF_ONE_MINUS_DEST_ALPHA,
SBF_ONE_MINUS_SOURCE_ALPHA
};
enum SceneBlendOperation
{
SBO_ADD,
SBO_SUBTRACT,
SBO_REVERSE_SUBTRACT,
SBO_MIN,
SBO_MAX
};
}
#endif
Ogre::SBF_SOURCE_COLOUR
Definition: OgreBlendMode.h:239
Ogre::SBT_REPLACE
The default blend mode where source replaces destination.
Definition: OgreBlendMode.h:226
Ogre::SBO_SUBTRACT
Definition: OgreBlendMode.h:256
Ogre::LBS_CURRENT
the colour as built up from previous stages
Definition: OgreBlendMode.h:115
Ogre::LBX_MODULATE
multiply source1 and source2 together
Definition: OgreBlendMode.h:81
Ogre::SBO_MAX
Definition: OgreBlendMode.h:259
Ogre::LayerBlendModeEx::alphaArg1
Real alphaArg1
Manual alpha value for manual source1.
Definition: OgreBlendMode.h:156
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::LayerBlendSource
LayerBlendSource
List of valid sources of values for blending operations used in TextureUnitState::setColourOperation ...
Definition: OgreBlendMode.h:112
Ogre::LayerBlendModeEx::colourArg2
ColourValue colourArg2
Manual colour value for manual source2.
Definition: OgreBlendMode.h:154
Ogre::LBX_ADD_SMOOTH
as LBX_ADD, but subtract product from the sum
Definition: OgreBlendMode.h:91
Ogre::LayerBlendModeEx::operator==
bool operator==(const LayerBlendModeEx &rhs) const
Definition: OgreBlendMode.h:162
Ogre::SBT_ADD
Add the texture values to the existing scene content.
Definition: OgreBlendMode.h:222
Ogre::LayerBlendModeEx::colourArg1
ColourValue colourArg1
Manual colour value for manual source1.
Definition: OgreBlendMode.h:152
Ogre::SBF_ZERO
Definition: OgreBlendMode.h:237
Ogre::SBF_ONE_MINUS_SOURCE_COLOUR
Definition: OgreBlendMode.h:241
Ogre::ColourValue
Class representing colour.
Definition: OgreColourValue.h:57
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::LayerBlendModeEx::source2
LayerBlendSource source2
The second source of colour/alpha.
Definition: OgreBlendMode.h:149
Ogre::SceneBlendType
SceneBlendType
Types of blending that you can specify between an object and the existing contents of the scene...
Definition: OgreBlendMode.h:215
Ogre::LayerBlendModeEx::factor
Real factor
Manual blending factor.
Definition: OgreBlendMode.h:160
Ogre::SBF_ONE_MINUS_DEST_COLOUR
Definition: OgreBlendMode.h:240
Ogre::LayerBlendModeEx::alphaArg2
Real alphaArg2
Manual alpha value for manual source2.
Definition: OgreBlendMode.h:158
Ogre::LBO_REPLACE
Replace all colour with texture with no adjustment.
Definition: OgreBlendMode.h:59
Ogre::SBO_REVERSE_SUBTRACT
Definition: OgreBlendMode.h:257
Ogre::LayerBlendModeEx::operator!=
bool operator!=(const LayerBlendModeEx &rhs) const
Definition: OgreBlendMode.h:194
Ogre::LBX_BLEND_DIFFUSE_COLOUR
use interpolated color values from vertices to scale source1, then add source2 scaled by (1-color) ...
Definition: OgreBlendMode.h:105
Ogre::LBS_MANUAL
a colour supplied manually as a separate argument
Definition: OgreBlendMode.h:123
Ogre::LBX_SOURCE2
use source2 without modification
Definition: OgreBlendMode.h:79
Ogre::LBX_DOTPRODUCT
dot product of color1 and color2
Definition: OgreBlendMode.h:103
Ogre::LBX_BLEND_TEXTURE_ALPHA
as LBX_BLEND_DIFFUSE_ALPHA, but use alpha from texture
Definition: OgreBlendMode.h:97
Ogre::LayerBlendType
LayerBlendType
Type of texture blend mode.
Definition: OgreBlendMode.h:44
Ogre::SBF_ONE
Definition: OgreBlendMode.h:236
OgrePrerequisites.h
Ogre::SBT_TRANSPARENT_COLOUR
Make the object transparent based on the colour values in the texture (brighter = more opaque) ...
Definition: OgreBlendMode.h:220
Ogre::LBS_DIFFUSE
the interpolated diffuse colour from the vertices
Definition: OgreBlendMode.h:119
Ogre::LayerBlendModeEx
Class which manages blending of both colour and alpha components.
Definition: OgreBlendMode.h:139
Ogre::LBT_ALPHA
Definition: OgreBlendMode.h:47
Ogre::LBO_ALPHA_BLEND
Blend based on texture alpha.
Definition: OgreBlendMode.h:65
Ogre::LBX_ADD_SIGNED
as LBX_ADD, but subtract 0.5 from the result
Definition: OgreBlendMode.h:89
Ogre::LBX_MODULATE_X4
as LBX_MODULATE but brighten more afterwards (x4)
Definition: OgreBlendMode.h:85
Ogre::SBF_DEST_COLOUR
Definition: OgreBlendMode.h:238
Ogre::LBO_ADD
Add colour components together.
Definition: OgreBlendMode.h:61
Ogre::LBX_BLEND_DIFFUSE_ALPHA
use interpolated alpha value from vertices to scale source1, then add source2 scaled by (1-alpha) ...
Definition: OgreBlendMode.h:95
Ogre::LayerBlendModeEx::operation
LayerBlendOperationEx operation
The operation to be applied.
Definition: OgreBlendMode.h:145
Ogre::LBX_SOURCE1
use source1 without modification
Definition: OgreBlendMode.h:77
Ogre::SBF_ONE_MINUS_DEST_ALPHA
Definition: OgreBlendMode.h:244
Ogre::LBX_SUBTRACT
subtract source2 from source1
Definition: OgreBlendMode.h:93
Ogre::SBO_MIN
Definition: OgreBlendMode.h:258
Ogre::LayerBlendOperationEx
LayerBlendOperationEx
Expert list of valid texture blending operations, for use with TextureUnitState::setColourOperationEx...
Definition: OgreBlendMode.h:75
Ogre::SBT_MODULATE
Multiply the 2 colours together.
Definition: OgreBlendMode.h:224
Ogre::LBO_MODULATE
Multiply colour components together.
Definition: OgreBlendMode.h:63
Ogre::LBS_SPECULAR
the interpolated specular colour from the vertices
Definition: OgreBlendMode.h:121
Ogre::SceneBlendFactor
SceneBlendFactor
Blending factors for manually blending objects with the scene.
Definition: OgreBlendMode.h:234
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::SBF_DEST_ALPHA
Definition: OgreBlendMode.h:242
Ogre::SBO_ADD
Definition: OgreBlendMode.h:255
Ogre::LBX_BLEND_CURRENT_ALPHA
as LBX_BLEND_DIFFUSE_ALPHA, but use current alpha from previous stages
Definition: OgreBlendMode.h:99
Ogre::LBX_ADD
add source1 and source2 together
Definition: OgreBlendMode.h:87
Ogre::LayerBlendModeEx::source1
LayerBlendSource source1
The first source of colour/alpha.
Definition: OgreBlendMode.h:147
OgreColourValue.h
Ogre::LBX_MODULATE_X2
as LBX_MODULATE but brighten afterwards (x2)
Definition: OgreBlendMode.h:83
Ogre::SBF_ONE_MINUS_SOURCE_ALPHA
Definition: OgreBlendMode.h:245
Ogre::LayerBlendModeEx::blendType
LayerBlendType blendType
The type of blending (colour or alpha)
Definition: OgreBlendMode.h:143
Ogre::SceneBlendOperation
SceneBlendOperation
Blending operations controls how objects are blended into the scene.
Definition: OgreBlendMode.h:253
Ogre::SBT_TRANSPARENT_ALPHA
Make the object transparent based on the final alpha values in the texture.
Definition: OgreBlendMode.h:218
Ogre::LBS_TEXTURE
the colour derived from the texture assigned to this layer
Definition: OgreBlendMode.h:117
Ogre::LBX_BLEND_MANUAL
as LBX_BLEND_DIFFUSE_ALPHA but use a constant manual blend value (0.0-1.0)
Definition: OgreBlendMode.h:101
Ogre::LBT_COLOUR
Definition: OgreBlendMode.h:46
Ogre::LayerBlendOperation
LayerBlendOperation
List of valid texture blending operations, for use with TextureUnitState::setColourOperation.
Definition: OgreBlendMode.h:57
Ogre::SBF_SOURCE_ALPHA
Definition: OgreBlendMode.h:243

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.