/
BlendFunc.cs
84 lines (73 loc) · 1.94 KB
/
BlendFunc.cs
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
using System;
namespace Sce.PlayStation.Core.Graphics
{
public partial class GL
{
private static BlendEquationMode blendEquation;
public enum BlendEquationMode
{
FuncAdd = (byte)BlendFuncMode.Add,
FuncReverseSubtract = (byte)BlendFuncMode.ReverseSubtract,
FuncSubtract = (byte)BlendFuncMode.Subtract
}
public enum AlphaFunction
{
Always,
Equal,
Gequal,
Greater,
Lequal,
Less,
Never,
Notequal
}
public enum EnableCap : uint
{
CullFace = EnableMode.CullFace,
Lighting = 1000u,
Fog = 1000u,
DepthTest = EnableMode.DepthTest,
StencilTest = EnableMode.StencilTest,
Dither = EnableMode.Dither,
Blend = EnableMode.Blend,
ScissorTest = EnableMode.ScissorTest,
Light0 = 1000u,
Light1 = 1000u,
Light2 = 1000u,
Light3 = 1000u,
Light4 = 1000u,
Light5 = 1000u,
Light6 = 1000u,
Light7 = 1000u,
Multisample = 1001u,
PolygonOffsetFill = EnableMode.PolygonOffsetFill
}
public static void Enable (EnableCap enable)
{
EnableMode m;
if(Enum.TryParse<EnableMode>(enable.ToString(), out m)) graphics.Enable(m); //If PSM supports the requested feature, enable it
else if(enable.HasFlag(EnableCap.Multisample))
{
GraphicsContext temp = graphics; //Create a copy
graphics = new GraphicsContext(temp.Screen.Width, temp.Screen.Height,PixelFormat.RgbaH,
PixelFormat.Depth24Stencil8, MultiSampleMode.Msaa2x);
}
}
public static void BlendColor (Single red, Single green, Single blue, Single alpha)
{
//Dummy implementation, PSM does not seem to support
}
public static void BlendEquation (BlendEquationMode blend)
{
blendEquation = blend;
}
public static void BlendFunc (BlendFuncFactor src, BlendFuncFactor dst)
{
graphics.SetBlendFunc ((BlendFuncMode)blendEquation, src, dst);
}
public static void AlphaFunc (AlphaFunction alpha, ref Single @ref)
{
#warning NOT IMPLEMENTED YET
}
}
}