computed face tint
This commit is contained in:
@@ -71,15 +71,18 @@ public abstract class AbstractSectionRenderer <T extends Viewport<T>, J extends
|
|||||||
public void addDebug(List<String> lines) {}
|
public void addDebug(List<String> lines) {}
|
||||||
|
|
||||||
protected static void addDirectionalFaceTint(Shader.Builder<?> builder, ClientLevel cl) {
|
protected static void addDirectionalFaceTint(Shader.Builder<?> builder, ClientLevel cl) {
|
||||||
|
builder.define("NO_SHADE_FACE_TINT", cl.getShade(Direction.UP, false));
|
||||||
|
builder.define("UP_FACE_TINT", cl.getShade(Direction.UP, true));
|
||||||
|
builder.define("DOWN_FACE_TINT", cl.getShade(Direction.DOWN, true));
|
||||||
|
builder.define("Z_AXIS_FACE_TINT", cl.getShade(Direction.NORTH, true));//assumed here that Direction.SOUTH returns the same value
|
||||||
|
builder.define("X_AXIS_FACE_TINT", cl.getShade(Direction.EAST, true));//assumed here that Direction.WEST returns the same value
|
||||||
|
/*
|
||||||
//TODO: generate the tinting table here and use the replacement feature
|
//TODO: generate the tinting table here and use the replacement feature
|
||||||
float[] tints = new float[7];
|
float[] tints = new float[7];
|
||||||
tints[6] = cl.getShade(Direction.UP, false);
|
tints[6] = cl.getShade(Direction.UP, false);
|
||||||
for (Direction direction : Direction.values()) {
|
for (Direction direction : Direction.values()) {
|
||||||
tints[direction.get3DDataValue()] = cl.getShade(direction, true);
|
tints[direction.get3DDataValue()] = cl.getShade(direction, true);
|
||||||
}
|
}*/
|
||||||
if (cl.dimensionType().cardinalLightType() == DimensionType.CardinalLightType.NETHER) {
|
|
||||||
builder.define("DARKENED_TINTING");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Shader tryCompilePatchedOrNormal(Shader.Builder<?> builder, String shader, String original) {
|
protected static Shader tryCompilePatchedOrNormal(Shader.Builder<?> builder, String shader, String original) {
|
||||||
|
|||||||
@@ -179,36 +179,23 @@ vec2 getCornerUV(const in QuadData quad, uint cornerId) {
|
|||||||
#ifndef PATCHED_SHADER
|
#ifndef PATCHED_SHADER
|
||||||
float computeDirectionalFaceTint(bool isShaded, uint face) {
|
float computeDirectionalFaceTint(bool isShaded, uint face) {
|
||||||
//Apply face tint
|
//Apply face tint
|
||||||
#ifdef DARKENED_TINTING
|
|
||||||
if (isShaded) {
|
if (isShaded) {
|
||||||
//just index on a const array with the face as an index, will be much faster
|
//just index on a const array with the face as an index, will be much faster
|
||||||
// or use a vector and select/sum
|
// or use a vector and select/sum
|
||||||
// but per face might be easier?
|
// but per face might be easier?
|
||||||
//TODO: make branchless, infact apply ahead of time to the texture itself in ModelManager since that is
|
|
||||||
// per face
|
|
||||||
if ((face>>1) == 1) {//NORTH, SOUTH
|
if ((face>>1) == 1) {//NORTH, SOUTH
|
||||||
return 0.8f;
|
return Z_AXIS_FACE_TINT;
|
||||||
} else if ((face>>1) == 2) {//EAST, WEST
|
} else if ((face>>1) == 2) {//EAST, WEST
|
||||||
return 0.6f;
|
return X_AXIS_FACE_TINT;
|
||||||
} else {//UP DOWN
|
} else if (face == 1) {//UP
|
||||||
return 0.9f;
|
return UP_FACE_TINT;
|
||||||
}
|
}
|
||||||
|
//DOWN
|
||||||
|
return DOWN_FACE_TINT;
|
||||||
} else {
|
} else {
|
||||||
return 0.9f;
|
return NO_SHADE_FACE_TINT;
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (isShaded) {
|
|
||||||
//TODO: make branchless, infact apply ahead of time to the texture itself in ModelManager since that is
|
|
||||||
// per face
|
|
||||||
if ((face>>1) == 1) {//NORTH, SOUTH
|
|
||||||
return 0.8f;
|
|
||||||
} else if ((face>>1) == 2) {//EAST, WEST
|
|
||||||
return 0.6f;
|
|
||||||
} else if (face == 0) {//DOWN
|
|
||||||
return 0.5f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 1.0f;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user