1
0
Fork 0

revert some improved rendering

This commit is contained in:
Sen 2025-08-31 11:40:53 +02:00
parent 9d31588d8d
commit 4862b7c9b5
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
4 changed files with 10 additions and 57 deletions

View file

@ -311,18 +311,6 @@ public class Client implements IThreadListener {
Client.CLIENT.setMidiDebug();
}
}
public static class TextureBoolFunction implements BoolFunction {
public void apply(BoolVar cv, boolean value) {
Client.CLIENT.updateTexture();
}
}
public static class TextureFloatFunction implements FloatFunction {
public void apply(FloatVar cv, float value) {
Client.CLIENT.updateTexture();
}
}
public static class MipmapFunction implements EnumFunction<MipmapType> {
public void apply(EnumVar cv, MipmapType value) {
@ -545,7 +533,6 @@ public class Client implements IThreadListener {
private long tick_update;
private long syncLimit;
private float anisotropyMax;
private float deltaX;
private float deltaY;
private float framerate;
@ -716,25 +703,8 @@ public class Client implements IThreadListener {
@Variable(name = "gl_light_blend", category = CVarCategory.RENDER, min = 0.0f, max = 1.0f, precision = 2, unit = "%", display = "Lichtüberdeckung")
public float lightBlend = 0.5f;
@Variable(name = "gl_dynlight_maxdist", category = CVarCategory.RENDER, min = 1.0f, max = 10000.0f, display = "Entfernung Lichtquelle")
public float lightDistVert = 128.0f;
@Variable(name = "gl_dynlight_viewdist", category = CVarCategory.RENDER, min = 1.0f, max = 10000.0f, display = "Entfernung Licht Kamera")
public float lightDistCam = 256.0f;
@Variable(name = "gl_dynlight_max", category = CVarCategory.RENDER, min = 0, max = 112, display = "Max. Dyn. Lichtquellen")
public int lightMaximum = 64;
@Variable(name = "gl_dynlight_chunkrange", category = CVarCategory.RENDER, min = 0, max = 64, display = "Lichtq. Sichtweite")
public int lightDistance = 8;
@Variable(name = "gl_tex_anisotropic", category = CVarCategory.RENDER, min = 1.0f, max = 16.0f, precision = 1, display = "Anisotrope Filterung", callback = TextureFloatFunction.class)
private float anisotopicFiltering = 16.0f;
@Variable(name = "gl_tex_mipmaps", category = CVarCategory.RENDER, display = "Mipmaps", callback = MipmapFunction.class)
private MipmapType mipmapType = MipmapType.LINEAR;
@Variable(name = "gl_tex_filter", category = CVarCategory.RENDER, display = "Texturfilterung", callback = TextureBoolFunction.class)
private boolean textureFiltering = true;
@Variable(name = "gl_specular", category = CVarCategory.RENDER, display = "Beleuchtungseffekte")
public boolean specularColors = true;
@Variable(name = "gl_flat_shading", category = CVarCategory.RENDER, display = "Flaches Shading")
public boolean flatShading = false;
@Variable(name = "gl_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden")
public boolean useShader = true;
@ -889,7 +859,6 @@ public class Client implements IThreadListener {
this.textureManager = new TextureManager();
this.textureManager.onReload();
this.soundManager = new SoundManager(this);
Log.RENDER.debug("Maximale Anisotropie: %.1f", this.anisotropyMax = GL46.glGetFloat(GL46.GL_MAX_TEXTURE_MAX_ANISOTROPY));
Log.RENDER.debug("Maximale Texturgröße: %d", GL46.glGetInteger(GL46.GL_MAX_TEXTURE_SIZE));
GlState.enableTexture2D();
GlState.shadeModel(GL46.GL_SMOOTH);
@ -2055,9 +2024,7 @@ public class Client implements IThreadListener {
this.dimensionName) + "\n" +
String.format("Licht: %06x", chunk.getLight(pos)) + " (" + (this.world.dimension.hasSkyLight() ? + Renderer.getSkyLightFor(pos.getY()) + " Himmel, " : "")
+ chunk.getLight(pos) + " Blöcke, " + String.format(
"%.1f", this.renderer.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
+ String.format("%.1f ° (%.1f, %.1f)", this.renderer.getCelestialAngle(1.0f), !this.world.dimension.hasDaylight() ? 0.0f : ExtMath.cos((-90.0f + this.renderer.getCelestialAngle(1.0f)) / 180.0f * (float)Math.PI),
!this.world.dimension.hasDaylight() ? -1.0f : ExtMath.sin((-90.0f + this.renderer.getCelestialAngle(1.0f)) / 180.0f * (float)Math.PI)) + "\n" +
"%.1f", this.renderer.getSunBrightness(1.0f) * 15.0f) + " Welt), A: " + String.format("%.1f °", this.renderer.getCelestialAngle(1.0f)) + "\n" +
String.format("Zeit: %s" + (this.world.dimension.hasRotation() ? ", R %d / %d T" : "") + (this.world.dimension.hasOrbit() ? ", U %d / %d T" : ""),
this.world.formatEpochSimple(),
this.world.getRotation(),
@ -3873,7 +3840,7 @@ public class Client implements IThreadListener {
public void updateTexture() {
this.textureManager.bindTexture(TextureMap.BLOCKS);
TextureUtil.setParams(this.textureFiltering, this.mipmapType != MipmapType.NONE, this.mipmapType == MipmapType.LINEAR, Math.min(this.anisotopicFiltering, this.anisotropyMax));
TextureUtil.setParams(this.mipmapType != MipmapType.NONE, this.mipmapType == MipmapType.LINEAR);
}
private static byte[] genTriwave(int w, int h, int color1, int color2, int color3, int color4, int color5, int color6) {

View file

@ -20,23 +20,11 @@ public class GuiGraphics extends GuiOptions {
this.addSelector("crosshair_color_target", 242, 100, 240, 0);
this.addSelector("hud_margin", 0, 140, 240, 0);
this.addSelector("gl_dynlight_max", 0, 180, 240, 0);
this.addSelector("gl_dynlight_chunkrange", 242, 180, 240, 0);
this.addSelector("gl_dynlight_viewdist", 0, 200, 240, 0);
this.addSelector("gl_dynlight_maxdist", 242, 200, 240, 0);
this.addSelector("gl_use_shader", 0, 180, 240, 0);
this.addSelector("gl_light_blend", 242, 180, 240, 0);
this.addSelector("gl_use_shader", 0, 220, 240, 0);
this.addSelector("gl_light_blend", 242, 220, 240, 0);
this.addSelector("gl_specular", 0, 240, 240, 0);
this.addSelector("gl_flat_shading", 242, 240, 240, 0);
this.addSelector("gl_tex_filter", 0, 260, 240, 0);
this.addSelector("gl_tex_mipmaps", 242, 260, 240, 0);
this.addSelector("gl_tex_anisotropic", 0, 280, 240, 0);
this.addSelector("gl_tex_mipmaps", 242, 200, 240, 0);
super.init(width, height);
}

View file

@ -18,7 +18,6 @@ public class DefaultVertexFormats
public static final VertexFormatElement TEX_2F = new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2);
public static final VertexFormatElement TEX_2S = new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2);
public static final VertexFormatElement NORMAL_3B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3);
public static final VertexFormatElement NORMAL_4B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 4);
public static final VertexFormatElement PADDING_1B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1);
static

View file

@ -22,19 +22,18 @@ public class TextureUtil
public static final DynamicTexture MISSING = new DynamicTexture(16, 16);
public static final int[] MISSING_DATA = MISSING.getData();
public static void setParams(boolean filter, boolean mips, boolean linear, float aniso) {
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MIN_FILTER, filter ? (mips ? (linear ? GL46.GL_LINEAR_MIPMAP_LINEAR : GL46.GL_LINEAR_MIPMAP_NEAREST) : GL46.GL_LINEAR) : (mips ? (linear ? GL46.GL_NEAREST_MIPMAP_LINEAR : GL46.GL_NEAREST_MIPMAP_NEAREST) : GL46.GL_NEAREST));
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAG_FILTER, filter ? GL46.GL_LINEAR : GL46.GL_NEAREST);
public static void setParams(boolean mips, boolean linear) {
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MIN_FILTER, mips ? (linear ? GL46.GL_NEAREST_MIPMAP_LINEAR : GL46.GL_NEAREST_MIPMAP_NEAREST) : GL46.GL_NEAREST);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAG_FILTER, GL46.GL_NEAREST);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_S, GL46.GL_REPEAT);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_T, GL46.GL_REPEAT);
GL46.glTexParameterf(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAX_ANISOTROPY, aniso);
}
public static void uploadTexture(int[] data, int w, int h, int x, int y, boolean params)
{
int i = 4194304 / w;
if(params)
setParams(false, false, false, 1.0f);
setParams(false, false);
int l;
for (int j = 0; j < w * h; j += w * l)
@ -57,7 +56,7 @@ public class TextureUtil
int h = img.getHeight();
int k = 4194304 / w;
int[] data = new int[k * w];
setParams(false, false, false, 1.0f);
setParams(false, false);
for (int l = 0; l < w * h; l += w * k)
{