PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 2ms RepoModel.GetById 38ms app.codeStats 0ms

/Utilities/Graphics/BlendMode.cs

#
C# | 69 lines | 12 code | 5 blank | 52 comment | 0 complexity | 43884dd020614a974376748411bd24bd MD5 | raw file
 1namespace Delta.Utilities.Graphics
 2{
 3	/// <summary>
 4	/// Blending presets are used for setting alpha blending operations of
 5	/// various types for producing different effects. Now set directly
 6	/// in materials because we want to sort them by blend mode too :)
 7	/// Note: Needed in Content modules already because atlas textures
 8	/// need to know about the blend modes!
 9	/// </summary>
10	public enum BlendMode
11	{
12		/// <summary>
13		/// The default preset is opaque, which is the fastest blending type
14		/// because it uses no blending obviously. Also works with AlphaTesting,
15		/// which is decided once a material is created (then an AlphaTest shader
16		/// will be chosen). This blend state is the default for all materials
17		/// that have no alpha channel in the diffuseMap!
18		/// </summary>
19		Opaque,
20
21		/// <summary>
22		/// Same as opaque, but use AlphaTest to discard any pixel below 0.66f
23		/// in the alpha channel. Rendering this is faster than Translucency
24		/// because we need no sorting and we can skip lots of pixels, which
25		/// makes the pixel shader go faster. This is however not always true for
26		/// mobile GPUs as discard is sometimes as expensive as actual rendering!
27		/// Still this is a useful feature to not write to the depth buffer for
28		/// transparent pixels thus helping with sorting.
29		/// </summary>
30		AlphaTest,
31
32		/// <summary>
33		/// Subtractive rendering mode is pretty much the opposite of additive
34		/// blending. Instead of always adding more brightness to the target
35		/// screen pixels, this one subtracts brightness. It is usually and
36		/// mostly only used for fake shadowing effects (blob shadows) and
37		/// sometimes in clever combinations of particle effects.
38		/// </summary>
39		Subtractive,
40
41		/// <summary>
42		/// Additive blending is used to accumulate the color we already got
43		/// on screen plus the diffuseMap * AmbientColor. This makes the result
44		/// image brighter and should be used with care. Has the advantage that
45		/// we do not need to sort, we can just render this out in any order
46		/// on top of the Opaque materials and it will always look the same.
47		/// This blend state usually has to be set by hand to a material!
48		/// </summary>
49		Additive,
50
51		/// <summary>
52		/// The normal version of alpha blending, which uses ambientColor.A *
53		/// diffuseMap alpha and blends that with SrcAlpha InvDestColor (default
54		/// alpha blending technique). This blend mode is the default for
55		/// all materials that have an alpha channel in diffuseMap!
56		/// Note: Only translucent images with alpha should use this blend mode.
57		/// </summary>
58		Translucency,
59
60		/// <summary>
61		/// LightEffect, which is using a special blend mode of DestColor+One,
62		/// which will maybe change later a bit. Basically used for light effects
63		/// (similar to lightmap shader, but just using a lightmap, no diffuse
64		/// texture). Needs to set by hand for lightmap materials, only a couple
65		/// of materials even need to use this, e.g. glow, light and flare effects.
66		/// </summary>
67		LightEffect,
68	}
69}