| 1 | package com.mojang.renderpearl.api.pipeline;
|
| 2 |
|
| 3 | import net.fabricmc.api.EnvType;
|
| 4 | import net.fabricmc.api.Environment;
|
| 5 |
|
| 6 | @Environment(EnvType.CLIENT)
|
| 7 | public record BlendFunction(BlendEquation color, BlendEquation alpha) {
|
| 8 | public static final BlendFunction LIGHTNING = new BlendFunction(BlendFactor.SRC_ALPHA, BlendFactor.ONE);
|
| 9 | public static final BlendFunction GLINT = new BlendFunction(BlendFactor.SRC_COLOR, BlendFactor.ONE, BlendFactor.ZERO, BlendFactor.ONE);
|
| 10 | public static final BlendFunction OVERLAY = new BlendFunction(BlendFactor.SRC_ALPHA, BlendFactor.ONE, BlendFactor.ONE, BlendFactor.ZERO);
|
| 11 | public static final BlendFunction TRANSLUCENT = new BlendFunction(
|
| 12 | BlendFactor.SRC_ALPHA, BlendFactor.ONE_MINUS_SRC_ALPHA, BlendFactor.ONE, BlendFactor.ONE_MINUS_SRC_ALPHA
|
| 13 | );
|
| 14 | public static final BlendFunction TRANSLUCENT_PREMULTIPLIED_ALPHA = new BlendFunction(
|
| 15 | BlendFactor.ONE, BlendFactor.ONE_MINUS_SRC_ALPHA, BlendFactor.ONE, BlendFactor.ONE_MINUS_SRC_ALPHA
|
| 16 | );
|
| 17 | public static final BlendFunction ADDITIVE = new BlendFunction(BlendFactor.ONE, BlendFactor.ONE);
|
| 18 | public static final BlendFunction ENTITY_OUTLINE_BLIT = new BlendFunction(
|
| 19 | BlendFactor.SRC_ALPHA, BlendFactor.ONE_MINUS_SRC_ALPHA, BlendFactor.ZERO, BlendFactor.ONE
|
| 20 | );
|
| 21 | public static final BlendFunction INVERT = new BlendFunction(
|
| 22 | BlendFactor.ONE_MINUS_DST_COLOR, BlendFactor.ONE_MINUS_SRC_COLOR, BlendFactor.ONE, BlendFactor.ZERO
|
| 23 | );
|
| 24 | public static final BlendFunction MAX = new BlendFunction(BlendFactor.ONE, BlendFactor.ONE, BlendOp.MAX);
|
| 25 |
|
| 26 | public BlendFunction(
|
| 27 | final BlendFactor srcColorFactor,
|
| 28 | final BlendFactor dstColorFactor,
|
| 29 | final BlendOp colorOp,
|
| 30 | final BlendFactor srcAlphaFactor,
|
| 31 | final BlendFactor dstAlphaFactor,
|
| 32 | final BlendOp alphaOp
|
| 33 | ) {
|
| 34 | this(new BlendEquation(srcColorFactor, dstColorFactor, colorOp), new BlendEquation(srcAlphaFactor, dstAlphaFactor, alphaOp));
|
| 35 | }
|
| 36 |
|
| 37 | public BlendFunction(final BlendFactor srcColorFactor, final BlendFactor dstColorFactor, final BlendFactor srcAlphaFactor, final BlendFactor dstAlphaFactor) {
|
| 38 | this(srcColorFactor, dstColorFactor, BlendOp.ADD, srcAlphaFactor, dstAlphaFactor, BlendOp.ADD);
|
| 39 | }
|
| 40 |
|
| 41 | public BlendFunction(final BlendEquation equation) {
|
| 42 | this(equation, equation);
|
| 43 | }
|
| 44 |
|
| 45 | public BlendFunction(final BlendFactor srcFactor, final BlendFactor dstFactor, final BlendOp op) {
|
| 46 | this(new BlendEquation(srcFactor, dstFactor, op));
|
| 47 | }
|
| 48 |
|
| 49 | public BlendFunction(final BlendFactor srcFactor, final BlendFactor dstFactor) {
|
| 50 | this(new BlendEquation(srcFactor, dstFactor, BlendOp.ADD));
|
| 51 | }
|
| 52 | }
|
| 53 |
|