/usr/include/OGRE/OgreBlendMode.h is in libogre-1.8-dev 1.8.0+dfsg1-7+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2012 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 {
/** \addtogroup Core
* @{
*/
/** \addtogroup Materials
* @{
*/
/** Type of texture blend mode.
*/
enum LayerBlendType
{
LBT_COLOUR,
LBT_ALPHA
};
/** List of valid texture blending operations, for use with TextureUnitState::setColourOperation.
@remarks
This list is a more limited list than LayerBlendOperationEx because it only
includes operations that are supportable in both multipass and multitexture
rendering and thus provides automatic fallback if multitexture hardware
is lacking or insufficient.
*/
enum LayerBlendOperation {
/// Replace all colour with texture with no adjustment
LBO_REPLACE,
/// Add colour components together.
LBO_ADD,
/// Multiply colour components together.
LBO_MODULATE,
/// Blend based on texture alpha
LBO_ALPHA_BLEND
};
/** Expert list of valid texture blending operations, for use with TextureUnitState::setColourOperationEx
and TextureUnitState::setAlphaOperation, and internally in the LayerBlendModeEx class. It's worth
noting that these operations are for blending <i>between texture layers</i> and not between rendered objects
and the existing scene. Because all of these modes are only supported in multitexture hardware it may be
required to set up a fallback operation where this hardware is not available.
*/
enum LayerBlendOperationEx {
/// use source1 without modification
LBX_SOURCE1,
/// use source2 without modification
LBX_SOURCE2,
/// multiply source1 and source2 together
LBX_MODULATE,
/// as LBX_MODULATE but brighten afterwards (x2)
LBX_MODULATE_X2,
/// as LBX_MODULATE but brighten more afterwards (x4)
LBX_MODULATE_X4,
/// add source1 and source2 together
LBX_ADD,
/// as LBX_ADD, but subtract 0.5 from the result
LBX_ADD_SIGNED,
/// as LBX_ADD, but subtract product from the sum
LBX_ADD_SMOOTH,
/// subtract source2 from source1
LBX_SUBTRACT,
/// use interpolated alpha value from vertices to scale source1, then add source2 scaled by (1-alpha)
LBX_BLEND_DIFFUSE_ALPHA,
/// as LBX_BLEND_DIFFUSE_ALPHA, but use alpha from texture
LBX_BLEND_TEXTURE_ALPHA,
/// as LBX_BLEND_DIFFUSE_ALPHA, but use current alpha from previous stages
LBX_BLEND_CURRENT_ALPHA,
/// as LBX_BLEND_DIFFUSE_ALPHA but use a constant manual blend value (0.0-1.0)
LBX_BLEND_MANUAL,
/// dot product of color1 and color2
LBX_DOTPRODUCT,
/// use interpolated color values from vertices to scale source1, then add source2 scaled by (1-color)
LBX_BLEND_DIFFUSE_COLOUR
};
/** List of valid sources of values for blending operations used
in TextureUnitState::setColourOperation and TextureUnitState::setAlphaOperation,
and internally in the LayerBlendModeEx class.
*/
enum LayerBlendSource
{
/// the colour as built up from previous stages
LBS_CURRENT,
/// the colour derived from the texture assigned to this layer
LBS_TEXTURE,
/// the interpolated diffuse colour from the vertices
LBS_DIFFUSE,
/// the interpolated specular colour from the vertices
LBS_SPECULAR,
/// a colour supplied manually as a separate argument
LBS_MANUAL
};
/** Class which manages blending of both colour and alpha components.
@remarks
This class is a utility class used by both TextureUnitState and
RenderSystem to wrap up the details of a blending operation. This blending
operation could be used for blending colour or alpha in a texture layer.
This class is really only for use by OGRE, since apps can deal with
blending modes through the TextureUnitState class methods
setColourOperation and setAlphaOperation.
@par
It's worth noting that these operations are for blending <i>between texture
layers</i> and not between rendered objects and the existing scene. If
you wish to make an object blend with others in the scene, e.g. to make
transparent objects etc, use the Material::setSceneBlending method.
*/
class _OgreExport LayerBlendModeEx
{
public:
/// The type of blending (colour or alpha)
LayerBlendType blendType;
/// The operation to be applied
LayerBlendOperationEx operation;
/// The first source of colour/alpha
LayerBlendSource source1;
/// The second source of colour/alpha
LayerBlendSource source2;
/// Manual colour value for manual source1
ColourValue colourArg1;
/// Manual colour value for manual source2
ColourValue colourArg2;
/// Manual alpha value for manual source1
Real alphaArg1;
/// Manual alpha value for manual source2
Real alphaArg2;
/// Manual blending factor
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);
}
};
/** Types of blending that you can specify between an object and the existing contents of the scene.
@remarks
As opposed to the LayerBlendType, which classifies blends between texture layers, these blending
types blend between the output of the texture units and the pixels already in the viewport,
allowing for object transparency, glows, etc.
@par
These types are provided to give quick and easy access to common effects. You can also use
the more manual method of supplying source and destination blending factors.
See Material::setSceneBlending for more details.
@see
Material::setSceneBlending
*/
enum SceneBlendType
{
/// Make the object transparent based on the final alpha values in the texture
SBT_TRANSPARENT_ALPHA,
/// Make the object transparent based on the colour values in the texture (brighter = more opaque)
SBT_TRANSPARENT_COLOUR,
/// Add the texture values to the existing scene content
SBT_ADD,
/// Multiply the 2 colours together
SBT_MODULATE,
/// The default blend mode where source replaces destination
SBT_REPLACE
// TODO : more
};
/** Blending factors for manually blending objects with the scene. If there isn't a predefined
SceneBlendType that you like, then you can specify the blending factors directly to affect the
combination of object and the existing scene. See Material::setSceneBlending for more details.
*/
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
};
/** Blending operations controls how objects are blended into the scene. The default operation
is add (+) but by changing this you can change how drawn objects are blended into the
existing scene.
*/
enum SceneBlendOperation
{
SBO_ADD,
SBO_SUBTRACT,
SBO_REVERSE_SUBTRACT,
SBO_MIN,
SBO_MAX
};
/** @} */
/** @} */
}
#endif
|