-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🛠️ Allow custom blend modes in pipeline
- Loading branch information
1 parent
88dfdb7
commit e491ec1
Showing
2 changed files
with
19 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
namespace Bearded.Graphics.Pipelines.Context | ||
using OpenTK.Graphics.OpenGL; | ||
using static OpenTK.Graphics.OpenGL.BlendingFactor; | ||
using static OpenTK.Graphics.OpenGL.BlendEquationMode; | ||
|
||
namespace Bearded.Graphics.Pipelines.Context; | ||
|
||
public readonly record struct BlendMode( | ||
BlendingFactor Source, BlendingFactor Destination, BlendEquationMode Function) | ||
{ | ||
public enum BlendMode | ||
{ | ||
None = 0, | ||
Alpha, | ||
Add, | ||
Subtract, | ||
Multiply, | ||
Premultiplied, | ||
Min, | ||
Max, | ||
} | ||
public static BlendMode Disable => default; | ||
|
||
public static BlendMode Alpha => new(SrcAlpha, OneMinusSrcAlpha, FuncAdd); | ||
public static BlendMode Add => new(SrcAlpha, One, FuncAdd); | ||
public static BlendMode Subtract => new(SrcAlpha, One, FuncReverseSubtract); | ||
public static BlendMode Multiply => new(Zero, SrcColor, FuncAdd); | ||
public static BlendMode Premultiplied => new(One, OneMinusSrcAlpha, FuncAdd); | ||
public static BlendMode Min => new(One, One, BlendEquationMode.Min); | ||
public static BlendMode Max => new(One, One, BlendEquationMode.Max); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters