1
0
Fork 0

misc updates, remove mipmapping

This commit is contained in:
Sen 2025-09-01 16:03:50 +02:00
parent 88a6cbe826
commit 1ce918c0af
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
377 changed files with 2910 additions and 3223 deletions

View file

@ -168,7 +168,7 @@ import common.sound.EventType;
import common.sound.MovingSoundMinecart;
import common.sound.PositionedSound;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.LocalPos;
import common.util.BoundingBox;
import common.util.CharValidator;
import common.util.ChunkPos;
@ -176,13 +176,12 @@ import common.util.ExtMath;
import common.util.HitPosition;
import common.util.IntHashMap;
import common.util.LongHashMap;
import common.util.MutablePos;
import common.util.ParticleType;
import common.util.Color;
import common.util.Displayable;
import common.util.Util;
import common.util.Var;
import common.util.HitPosition.ObjectType;
import common.util.Identifyable;
import common.vars.Vars;
import common.world.Chunk;
import common.world.State;
@ -211,28 +210,6 @@ import common.world.World;
*/
public class Client implements IThreadListener {
public static enum MipmapType implements Identifyable, Displayable {
NONE("off", "Keine"),
NEAREST("nearest", "Nächster nachbar"),
LINEAR("linear", "Linear interpoliert");
private final String name;
private final String display;
private MipmapType(String name, String display) {
this.name = name;
this.display = display;
}
public String getName() {
return this.name;
}
public String getDisplay() {
return this.display;
}
}
public static class SyncFunction implements IntFunction {
public void apply(IntVar cv, int value) {
Client.CLIENT.sync(value);
@ -312,12 +289,6 @@ public class Client implements IThreadListener {
}
}
public static class MipmapFunction implements EnumFunction<MipmapType> {
public void apply(EnumVar cv, MipmapType value) {
Client.CLIENT.updateTexture();
}
}
public static class LightFunction implements FloatFunction {
public void apply(FloatVar cv, float value) {
Client.CLIENT.renderer.loadRenderers();
@ -366,11 +337,11 @@ public class Client implements IThreadListener {
return Client.this.getChunk(x, z);
}
public Chunk getChunk(BlockPos pos) {
public Chunk getChunk(LocalPos pos) {
return Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
}
protected float getTemperature(BlockPos pos) {
protected float getTemperature(LocalPos pos) {
if(!isValid(pos))
return 0.0f;
ChunkClient chunk = Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
@ -385,19 +356,19 @@ public class Client implements IThreadListener {
Client.this.effectRenderer.spawnParticle(Client.this.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, data);
}
public void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data) {
public void playEffect(EntityNPC player, int sfxType, LocalPos blockPosIn, int data) {
if(Client.this.getNetHandler() != null)
Client.this.getNetHandler().playAuxSFX(sfxType, blockPosIn, data);
}
public void markBlockForUpdate(BlockPos pos) {
public void markBlockForUpdate(LocalPos pos) {
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
Client.this.renderer.markUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
}
public void clientNotifyLight(BlockPos pos) {
public void clientNotifyLight(LocalPos pos) {
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
@ -412,15 +383,15 @@ public class Client implements IThreadListener {
Client.this.renderer.setLastLightning(last, color);
}
public void checkBlockLight(BlockPos pos) {
public void checkBlockLight(LocalPos pos) {
Client.this.renderer.checkBlockLight(pos);
}
public int getCombinedLight(BlockPos pos) {
public int getCombinedLight(LocalPos pos) {
return Client.this.renderer.getCombinedLight(pos);
}
public int getCombinedBrightness(BlockPos pos) {
public int getCombinedBrightness(LocalPos pos) {
return Client.this.renderer.getCombinedBrightness(pos);
}
}
@ -492,7 +463,6 @@ public class Client implements IThreadListener {
public boolean freecam;
public boolean servercam;
public boolean shaders;
public boolean mipmaps;
private int leftClickCounter;
private int rightClickTimer;
@ -574,7 +544,7 @@ public class Client implements IThreadListener {
public World world;
public EntityNPC player;
public HitPosition pointed;
public BlockPos pointedLiquid;
public LocalPos pointedLiquid;
public DisplayMode vidMode;
public String dimensionName;
private ChunkClient emptyChunk;
@ -594,9 +564,9 @@ public class Client implements IThreadListener {
private int lightUpdates = 2048;
@Variable(name = "chunk_light_range", category = CVarCategory.RENDER, min = 5, max = 1024, display = "Radius Licht-Updates")
private int lightRange = 32;
@Variable(name = "gl_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1)
@Variable(name = "draw_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1)
public float fov = 70.0f;
@Variable(name = "gl_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus")
@Variable(name = "draw_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus")
private boolean wireframe = false;
@Variable(name = "con_timestamps", category = CVarCategory.CONSOLE, display = "Zeiten")
@ -623,7 +593,7 @@ public class Client implements IThreadListener {
@Variable(name = "gui_scale_hotbar", category = CVarCategory.GUI, display = "Leiste vergrößern")
public boolean scaleHotbar = false;
@Variable(name = "hud_margin", category = CVarCategory.GUI, min = 0, max = 120, unit = "px", display = "Seitenabstand der HUD")
private int hudMargin = 8;
private int hudMargin = 4;
@Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%")
private float sensitivity = 1.0f;
@Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms")
@ -644,7 +614,7 @@ public class Client implements IThreadListener {
private boolean chatPermanent = false;
@Variable(name = "overlay_opacity", category = CVarCategory.CONSOLE, min = 0x00, max = 0xff, display = "Deckkraft Hintergrund")
private int hudOpacity = 0x40;
@Variable(name = "gl_vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren")
@Variable(name = "vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren")
private boolean glFlush = false;
@Variable(name = "con_autoclose", category = CVarCategory.CONSOLE, display = "Schließen")
public boolean conAutoclose = true;
@ -709,9 +679,7 @@ public class Client implements IThreadListener {
@Variable(name = "mid_visualizer", category = CVarCategory.SOUND, display = "Visualisation")
public boolean midiVisualizer = true;
@Variable(name = "gl_tex_mipmaps", category = CVarCategory.RENDER, display = "Mipmaps", callback = MipmapFunction.class)
private MipmapType mipmapType = MipmapType.NONE;
@Variable(name = "gl_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden")
@Variable(name = "draw_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden")
public boolean useShader = false;
public static final Client CLIENT = new Client();
@ -856,7 +824,8 @@ public class Client implements IThreadListener {
this.renderItem.onReload();
this.renderer.cacheSprites();
EntityTexManager.loadNpcTextures();
this.updateTexture();
this.textureManager.bindTexture(TextureMap.BLOCKS);
TextureUtil.setParams();
this.renderer.loadRenderers();
this.logFeed("Texturen wurden neu geladen");
}
@ -868,7 +837,6 @@ public class Client implements IThreadListener {
this.soundManager = new SoundManager(this);
Log.RENDER.debug("Maximale Texturgröße: %d", GL15.glGetInteger(GL15.GL_MAX_TEXTURE_SIZE));
Log.RENDER.debug("Shader verfügbar: %s", (this.shaders = GL.getCapabilities().OpenGL20) ? "Ja (OpenGL 2.0+)" : "Nein (OpenGL 1.5)");
Log.RENDER.debug("Mipmaps verfügbar: %s", (this.mipmaps = GL.getCapabilities().OpenGL30) ? "Ja (OpenGL 3.0+)" : "Nein (OpenGL 1.5-2.1)");
GlState.enableTexture2D();
GlState.shadeModel(GL15.GL_SMOOTH);
GL15.glClearDepth(1.0D);
@ -883,7 +851,8 @@ public class Client implements IThreadListener {
GL15.glMatrixMode(GL15.GL_MODELVIEW);
this.textureMap = new TextureMap();
this.textureManager.loadTexture(TextureMap.BLOCKS, this.textureMap);
this.updateTexture();
this.textureManager.bindTexture(TextureMap.BLOCKS);
TextureUtil.setParams();
this.modelManager = new ModelManager(this.textureMap);
this.modelManager.onReload();
this.renderItem = new RenderItem(this.textureManager, this.modelManager);
@ -1009,7 +978,7 @@ public class Client implements IThreadListener {
{
this.controller.update();
}
this.textureMap.update(this.mipmaps && this.mipmapType != MipmapType.NONE);
this.textureMap.update();
if (this.open != null)
{
this.open.updateScreen();
@ -1296,7 +1265,7 @@ public class Client implements IThreadListener {
int color = 0x000000;
float bar = -1.0f;
if((this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) || this.pointedLiquid != null) {
BlockPos pos = this.pointedLiquid != null ? this.pointedLiquid : this.pointed.block;
LocalPos pos = this.pointedLiquid != null ? this.pointedLiquid : this.pointed.block;
State state = this.world.getState(pos);
Block block = state.getBlock();
if(this.pointedLiquid != null ? block.getMaterial().isLiquid() : block != Blocks.air) {
@ -1576,7 +1545,7 @@ public class Client implements IThreadListener {
{
if (leftClick && this.pointed != null && this.pointed.type == HitPosition.ObjectType.BLOCK)
{
BlockPos blockpos = this.pointed.block;
LocalPos blockpos = this.pointed.block;
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.damageBlock(blockpos, this.pointed.side))
{
@ -1622,7 +1591,7 @@ public class Client implements IThreadListener {
break;
case BLOCK:
this.player.swingItem();
BlockPos blockpos = this.pointed.block;
LocalPos blockpos = this.pointed.block;
if (this.world.getState(blockpos).getBlock() != Blocks.air)
{
this.controller.clickBlock(blockpos, this.pointed.side);
@ -1678,7 +1647,7 @@ public class Client implements IThreadListener {
break;
case BLOCK:
BlockPos blockpos = this.pointed.block;
LocalPos blockpos = this.pointed.block;
if (this.world.getState(blockpos).getBlock() != Blocks.air)
{
@ -1987,7 +1956,7 @@ public class Client implements IThreadListener {
if(this.world == null)
return mem;
BlockPos pos = new BlockPos(this.viewEntity.posX, this.viewEntity.getEntityBoundingBox().minY, this.viewEntity.posZ);
LocalPos pos = new LocalPos(this.viewEntity.posX, this.viewEntity.getEntityBoundingBox().minY, this.viewEntity.posZ);
String dirStr;
switch(this.viewEntity.getHorizontalFacing()) {
case NORTH:
@ -2059,7 +2028,7 @@ public class Client implements IThreadListener {
;
}
private String formatState(BlockPos pos, String desc) {
private String formatState(LocalPos pos, String desc) {
State block = this.world.getState(pos);
if(!this.debugWorld) {
@ -2390,6 +2359,8 @@ public class Client implements IThreadListener {
GlState.enableBlend();
GlState.blendFunc(GL15.GL_SRC_ALPHA, GL15.GL_ONE_MINUS_SRC_ALPHA);
this.initConsole();
this.textureManager.bindTexture(TextureMap.BLOCKS);
TextureUtil.setParams();
if(this.shaders)
ShaderContext.loadShaders();
this.startSound(true);
@ -3529,7 +3500,7 @@ public class Client implements IThreadListener {
private void displayTick(int posX, int posY, int posZ) {
int range = 16;
Random rand = new Random();
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
MutablePos pos = new MutablePos();
for(int n = 0; n < 1000; n++) {
int x = posX + rand.zrange(range) - rand.zrange(range);
int y = posY + rand.zrange(range) - rand.zrange(range);
@ -3670,7 +3641,7 @@ public class Client implements IThreadListener {
int x = ExtMath.floord(this.player.posX) + this.world.rand.range(-radius, radius);
int y = ExtMath.floord(this.player.posY) + this.world.rand.range(-radius, radius);
int z = ExtMath.floord(this.player.posZ) + this.world.rand.range(-radius, radius);
this.world.checkBlockLight(new BlockPos(x, y, z));
this.world.checkBlockLight(new LocalPos(x, y, z));
}
}
@ -3850,11 +3821,6 @@ public class Client implements IThreadListener {
public List<TileEntity> getTiles() {
return this.tiles;
}
public void updateTexture() {
this.textureManager.bindTexture(TextureMap.BLOCKS);
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) {
byte[] data = new byte[w * h * 4];