mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 05:43:42 +01:00
Minor SBB clean up
- Allow custom light from dual (utility) light method to be applied - Reorganize and rename some members
This commit is contained in:
parent
3ab3bffac3
commit
e3386c178a
1 changed files with 16 additions and 16 deletions
|
@ -48,10 +48,10 @@ public class SuperByteBuffer {
|
||||||
|
|
||||||
// Vertex Lighting
|
// Vertex Lighting
|
||||||
private boolean useWorldLight;
|
private boolean useWorldLight;
|
||||||
private boolean hybridLight;
|
|
||||||
private boolean useCustomLightCoords;
|
|
||||||
private int packedLightCoords;
|
|
||||||
private Matrix4f lightTransform;
|
private Matrix4f lightTransform;
|
||||||
|
private boolean hasCustomLight;
|
||||||
|
private int packedLightCoords;
|
||||||
|
private boolean hybridLight;
|
||||||
|
|
||||||
// Vertex Normals
|
// Vertex Normals
|
||||||
private boolean fullNormalTransform;
|
private boolean fullNormalTransform;
|
||||||
|
@ -177,9 +177,10 @@ public class SuperByteBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
light = getLight(Minecraft.getInstance().world, lightPos);
|
light = getLight(Minecraft.getInstance().world, lightPos);
|
||||||
if (useCustomLightCoords)
|
if (hasCustomLight) {
|
||||||
light = maxLight(light, packedLightCoords);
|
light = maxLight(light, packedLightCoords);
|
||||||
} else if (useCustomLightCoords) {
|
}
|
||||||
|
} else if (hasCustomLight) {
|
||||||
light = packedLightCoords;
|
light = packedLightCoords;
|
||||||
} else {
|
} else {
|
||||||
light = template.getLight(i);
|
light = template.getLight(i);
|
||||||
|
@ -212,10 +213,10 @@ public class SuperByteBuffer {
|
||||||
hasOverlay = false;
|
hasOverlay = false;
|
||||||
overlay = OverlayTexture.DEFAULT_UV;
|
overlay = OverlayTexture.DEFAULT_UV;
|
||||||
useWorldLight = false;
|
useWorldLight = false;
|
||||||
useCustomLightCoords = false;
|
|
||||||
hybridLight = false;
|
|
||||||
packedLightCoords = 0;
|
|
||||||
lightTransform = null;
|
lightTransform = null;
|
||||||
|
hasCustomLight = false;
|
||||||
|
packedLightCoords = 0;
|
||||||
|
hybridLight = false;
|
||||||
fullNormalTransform = false;
|
fullNormalTransform = false;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -368,15 +369,14 @@ public class SuperByteBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuperByteBuffer light(int packedLightCoords) {
|
public SuperByteBuffer light(int packedLightCoords) {
|
||||||
useCustomLightCoords = true;
|
hasCustomLight = true;
|
||||||
this.packedLightCoords = packedLightCoords;
|
this.packedLightCoords = packedLightCoords;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuperByteBuffer light(Matrix4f lightTransform, int packedLightCoords) {
|
public SuperByteBuffer light(Matrix4f lightTransform, int packedLightCoords) {
|
||||||
useWorldLight = true;
|
light(lightTransform);
|
||||||
this.lightTransform = lightTransform;
|
light(packedLightCoords);
|
||||||
this.packedLightCoords = packedLightCoords;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +404,10 @@ public class SuperByteBuffer {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return template.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
public static int transformColor(byte component, float scale) {
|
public static int transformColor(byte component, float scale) {
|
||||||
return MathHelper.clamp((int) (Byte.toUnsignedInt(component) * scale), 0, 255);
|
return MathHelper.clamp((int) (Byte.toUnsignedInt(component) * scale), 0, 255);
|
||||||
}
|
}
|
||||||
|
@ -425,10 +429,6 @@ public class SuperByteBuffer {
|
||||||
return WORLD_LIGHT_CACHE.computeIfAbsent(pos.toLong(), $ -> WorldRenderer.getLightmapCoordinates(world, pos));
|
return WORLD_LIGHT_CACHE.computeIfAbsent(pos.toLong(), $ -> WorldRenderer.getLightmapCoordinates(world, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return template.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface SpriteShiftFunc {
|
public interface SpriteShiftFunc {
|
||||||
void shift(IVertexBuilder builder, float u, float v);
|
void shift(IVertexBuilder builder, float u, float v);
|
||||||
|
|
Loading…
Reference in a new issue