mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-17 19:15:06 +00:00
Shadow Compute Shaders (#1333)
This commit is contained in:
1 parent
b75a5d8f7d
commit
bee9541797
37 files changed
+1111
-252
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package net.coderbot.iris.gl.blending;
|
||||
|
||||
public class AlphaTest {
|
||||
public static final AlphaTest ALWAYS = new AlphaTest(AlphaTestFunction.ALWAYS, 0.0f);
|
||||
|
||||
private final AlphaTestFunction function;
|
||||
private final float reference;
|
||||
|
||||
@@ -16,4 +18,45 @@ public class AlphaTest {
|
||||
public float getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public String toExpression(String indentation) {
|
||||
return toExpression("gl_FragData[0].a", "iris_currentAlphaTest", indentation);
|
||||
}
|
||||
|
||||
public String toExpression(String alphaAccessor, String alphaThreshold, String indentation) {
|
||||
String expr = function.getExpression();
|
||||
|
||||
if (function == AlphaTestFunction.ALWAYS) {
|
||||
return "// alpha test disabled\n";
|
||||
} else if (function == AlphaTestFunction.NEVER) {
|
||||
return "discard;\n";
|
||||
}
|
||||
|
||||
return indentation + "if (!(" + alphaAccessor + " " + expr + " " + alphaThreshold + ")) {\n" +
|
||||
indentation + " discard;\n" +
|
||||
indentation + "}\n";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((function == null) ? 0 : function.hashCode());
|
||||
result = prime * result + Float.floatToIntBits(reference);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
AlphaTest other = (AlphaTest) obj;
|
||||
if (function != other.function)
|
||||
return false;
|
||||
return Float.floatToIntBits(reference) == Float.floatToIntBits(other.reference);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user