Fixed texture bleeding, fixed clamping in entity shadows

This commit is contained in:
LAX1DUDE 2022-04-16 01:01:40 -07:00
parent 1714cb1bda
commit af82d23f20
13 changed files with 49 additions and 42 deletions

View File

@ -185,7 +185,7 @@ public class EaglerAdapterImpl2 {
public static final int _wGL_SRC_COLOR = GL11.GL_SRC_COLOR; public static final int _wGL_SRC_COLOR = GL11.GL_SRC_COLOR;
public static final int _wGL_ONE = GL11.GL_ONE; public static final int _wGL_ONE = GL11.GL_ONE;
public static final int _wGL_NEAREST = GL11.GL_NEAREST; public static final int _wGL_NEAREST = GL11.GL_NEAREST;
public static final int _wGL_CLAMP = GL11.GL_REPEAT; public static final int _wGL_CLAMP = GL12.GL_CLAMP_TO_EDGE;
public static final int _wGL_TEXTURE_WRAP_S = GL11.GL_TEXTURE_WRAP_S; public static final int _wGL_TEXTURE_WRAP_S = GL11.GL_TEXTURE_WRAP_S;
public static final int _wGL_TEXTURE_WRAP_T = GL11.GL_TEXTURE_WRAP_T; public static final int _wGL_TEXTURE_WRAP_T = GL11.GL_TEXTURE_WRAP_T;
public static final int _wGL_TEXTURE_MAX_LEVEL = GL12.GL_TEXTURE_MAX_LEVEL; public static final int _wGL_TEXTURE_MAX_LEVEL = GL12.GL_TEXTURE_MAX_LEVEL;

View File

@ -4,7 +4,7 @@ public class ConfigConstants {
public static boolean profanity = false; public static boolean profanity = false;
public static final String version = "22w15c"; public static final String version = "22w15d";
public static final String mainMenuString = "eaglercraft " + version; public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft"; public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";

View File

@ -54,10 +54,10 @@ public class TextureTerrainMap implements IconRegister {
this.maxV = (float)(originY + 48) / (float)map.height; this.maxV = (float)(originY + 48) / (float)map.height;
this.originX_center = originX + 16; this.originX_center = originX + 16;
this.originY_center = originY + 16; this.originY_center = originY + 16;
this.minU_center = (float)originX_center / (float)map.width; this.minU_center = (float)(originX_center + 0.1f) / (float)map.width;
this.minV_center = (float)originY_center / (float)map.height; this.minV_center = (float)(originY_center + 0.1f) / (float)map.height;
this.maxU_center = (float)(originX_center + 16) / (float)map.width; this.maxU_center = (float)(originX_center + 16 - 0.1f) / (float)map.width;
this.maxV_center = (float)(originY_center + 16) / (float)map.height; this.maxV_center = (float)(originY_center + 16 - 0.1f) / (float)map.height;
} }
@Override @Override

View File

@ -681,7 +681,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
case GL_NEAREST_MIPMAP_NEAREST: pp3 = _wGL_NEAREST_MIPMAP_NEAREST; break; case GL_NEAREST_MIPMAP_NEAREST: pp3 = _wGL_NEAREST_MIPMAP_NEAREST; break;
case GL_NEAREST: pp3 = _wGL_NEAREST; break; case GL_NEAREST: pp3 = _wGL_NEAREST; break;
case GL_REPEAT: pp3 = _wGL_REPEAT; break; case GL_REPEAT: pp3 = _wGL_REPEAT; break;
case GL_CLAMP: pp3 = _wGL_REPEAT; break; case GL_CLAMP: pp3 = _wGL_CLAMP; break;
} }
if(selectedTex == 0 && boundTexture0 != null && pp2 == _wGL_TEXTURE_MAG_FILTER) { if(selectedTex == 0 && boundTexture0 != null && pp2 == _wGL_TEXTURE_MAG_FILTER) {

View File

@ -142,10 +142,11 @@ public class EntityFX extends Entity {
} }
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) { public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
float var8 = (float) this.particleTextureIndexX / 16.0F; float fix = 0.001f;
float var9 = var8 + 0.0624375F; float var8 = (float) this.particleTextureIndexX / 16.0F + fix;
float var10 = (float) this.particleTextureIndexY / 16.0F; float var9 = var8 + 0.0624375F - fix;
float var11 = var10 + 0.0624375F; float var10 = (float) this.particleTextureIndexY / 16.0F + fix;
float var11 = var10 + 0.0624375F - fix;
float var12 = 0.1F * this.particleScale; float var12 = 0.1F * this.particleScale;
if (this.particleIcon != null) { if (this.particleIcon != null) {

View File

@ -191,12 +191,12 @@ public class FontRenderer {
float var3 = (float) (par1 % 16 * 8); float var3 = (float) (par1 % 16 * 8);
float var4 = (float) (par1 / 16 * 8); float var4 = (float) (par1 / 16 * 8);
float var5 = par2 ? 1.0F : 0.0F; float var5 = par2 ? 1.0F : 0.0F;
float var6 = (float) this.charWidth[par1] - 0.02F; float var6 = (float) this.charWidth[par1] - 0.2F;
Tessellator t = Tessellator.instance; Tessellator t = Tessellator.instance;
t.addVertexWithUV(this.posX + 0.02F + var5, this.posY + 0.02F, 0.0F, (var3 + 0.02F) / 128.0F, (var4 + 0.02F) / 128.0F); t.addVertexWithUV(this.posX + 0.05F + var5, this.posY + 0.05F, 0.0F, (var3 + 0.1F) / 128.0F, (var4 + 0.1F) / 128.0F);
t.addVertexWithUV(this.posX + 0.02F - var5, this.posY + 7.98F, 0.0F, (var3 + 0.02F) / 128.0F, (var4 + 7.98F) / 128.0F); t.addVertexWithUV(this.posX + 0.05F - var5, this.posY + 7.95F, 0.0F, (var3 + 0.1F) / 128.0F, (var4 + 7.8F) / 128.0F);
t.addVertexWithUV(this.posX + var6 - var5, this.posY + 7.98F, 0.0F, (var3 + var6) / 128.0F, (var4 + 7.98F) / 128.0F); t.addVertexWithUV(this.posX + var6 - var5, this.posY + 7.95F, 0.0F, (var3 + var6) / 128.0F, (var4 + 7.8F) / 128.0F);
t.addVertexWithUV(this.posX + var6 + var5, this.posY + 0.02F, 0.0F, (var3 + var6) / 128.0F, (var4 + 0.02F) / 128.0F); t.addVertexWithUV(this.posX + var6 + var5, this.posY + 0.05F, 0.0F, (var3 + var6) / 128.0F, (var4 + 0.1F) / 128.0F);
return (float) this.charWidth[par1]; return (float) this.charWidth[par1];
} }

View File

@ -105,8 +105,11 @@ public abstract class Render {
*/ */
private void renderShadow(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { private void renderShadow(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND); EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA); EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
shadow.bindTexture(); shadow.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_WRAP_S, EaglerAdapter.GL_CLAMP);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_WRAP_T, EaglerAdapter.GL_CLAMP);
World var10 = this.getWorldFromRenderManager(); World var10 = this.getWorldFromRenderManager();
EaglerAdapter.glDepthMask(false); EaglerAdapter.glDepthMask(false);
float var11 = this.shadowSize; float var11 = this.shadowSize;
@ -150,6 +153,7 @@ public abstract class Render {
var30.draw(); var30.draw();
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glDepthMask(true); EaglerAdapter.glDepthMask(true);
} }

View File

@ -16,15 +16,16 @@ public class RenderArrow extends Render {
EaglerAdapter.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); EaglerAdapter.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator var10 = Tessellator.instance; Tessellator var10 = Tessellator.instance;
byte var11 = 0; byte var11 = 0;
float var12 = 0.0F; float fix = 0.002f;
float var13 = 0.5F; float var12 = 0.0F + fix;
float var14 = (float) (0 + var11 * 10) / 32.0F; float var13 = 0.5F - fix;
float var15 = (float) (5 + var11 * 10) / 32.0F; float var14 = (float) (0 + var11 * 10) / 32.0F + fix;
float var16 = 0.0F; float var15 = (float) (5 + var11 * 10) / 32.0F - fix;
float var17 = 0.15625F; float var16 = 0.0F + fix;
float var18 = (float) (5 + var11 * 10) / 32.0F; float var17 = 0.15625F - fix;
float var19 = (float) (10 + var11 * 10) / 32.0F; float var18 = (float) (5 + var11 * 10) / 32.0F + fix;
float var20 = 0.05625F; float var19 = (float) (10 + var11 * 10) / 32.0F - fix;
float var20 = 0.05625F + fix;
EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL); EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL);
float var21 = (float) par1EntityArrow.arrowShake - par9; float var21 = (float) par1EntityArrow.arrowShake - par9;
@ -53,7 +54,7 @@ public class RenderArrow extends Render {
for (int var23 = 0; var23 < 4; ++var23) { for (int var23 = 0; var23 < 4; ++var23) {
EaglerAdapter.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); EaglerAdapter.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
EaglerAdapter.glNormal3f(0.0F, 0.0F, var20); EaglerAdapter.glNormal3f(0.0F, 0.0F, -var20);
var10.startDrawingQuads(); var10.startDrawingQuads();
var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) var12, (double) var14); var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) var12, (double) var14);
var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) var13, (double) var14); var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) var13, (double) var14);

View File

@ -22,17 +22,17 @@ public class RenderFish extends Render {
byte var11 = 2; byte var11 = 2;
tex.bindTexture(); tex.bindTexture();
Tessellator var12 = Tessellator.instance; Tessellator var12 = Tessellator.instance;
float var13 = (float) (var10 * 8 + 0) / 128.0F; float var13 = (float) (var10 * 8 + 0 + 0.15f) / 128.0F;
float var14 = (float) (var10 * 8 + 8) / 128.0F; float var14 = (float) (var10 * 8 + 8 - 0.15f) / 128.0F;
float var15 = (float) (var11 * 8 + 0) / 128.0F; float var15 = (float) (var11 * 8 + 0 + 0.15f) / 128.0F;
float var16 = (float) (var11 * 8 + 8) / 128.0F; float var16 = (float) (var11 * 8 + 8 - 0.15f) / 128.0F;
float var17 = 1.0F; float var17 = 1.0F;
float var18 = 0.5F; float var18 = 0.5F;
float var19 = 0.5F; float var19 = 0.5F;
EaglerAdapter.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); EaglerAdapter.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
EaglerAdapter.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); EaglerAdapter.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
var12.startDrawingQuads(); var12.startDrawingQuads();
var12.setNormal(0.0F, 1.0F, 0.0F); var12.setNormal(0.0F, -1.0F, 0.0F);
var12.addVertexWithUV((double) (0.0F - var18), (double) (0.0F - var19), 0.0D, (double) var13, (double) var16); var12.addVertexWithUV((double) (0.0F - var18), (double) (0.0F - var19), 0.0D, (double) var13, (double) var16);
var12.addVertexWithUV((double) (var17 - var18), (double) (0.0F - var19), 0.0D, (double) var14, (double) var16); var12.addVertexWithUV((double) (var17 - var18), (double) (0.0F - var19), 0.0D, (double) var14, (double) var16);
var12.addVertexWithUV((double) (var17 - var18), (double) (1.0F - var19), 0.0D, (double) var14, (double) var15); var12.addVertexWithUV((double) (var17 - var18), (double) (1.0F - var19), 0.0D, (double) var14, (double) var15);

View File

@ -113,10 +113,11 @@ public class RenderItemFrame extends Render {
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE); EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
var4.startDrawingQuads(); var4.startDrawingQuads();
byte var5 = 7; byte var5 = 7;
var4.addVertexWithUV((double) (0 - var5), (double) (128 + var5), 0.0D, 0.0D, 1.0D); double d = 0.001d;
var4.addVertexWithUV((double) (128 + var5), (double) (128 + var5), 0.0D, 1.0D, 1.0D); var4.addVertexWithUV((double) (0 - var5), (double) (128 + var5), 0.0D, 0.0D + d, 1.0D - d);
var4.addVertexWithUV((double) (128 + var5), (double) (0 - var5), 0.0D, 1.0D, 0.0D); var4.addVertexWithUV((double) (128 + var5), (double) (128 + var5), 0.0D, 1.0D - d, 1.0D - d);
var4.addVertexWithUV((double) (0 - var5), (double) (0 - var5), 0.0D, 0.0D, 0.0D); var4.addVertexWithUV((double) (128 + var5), (double) (0 - var5), 0.0D, 1.0D - d, 0.0D + d);
var4.addVertexWithUV((double) (0 - var5), (double) (0 - var5), 0.0D, 0.0D + d, 0.0D + d);
var4.draw(); var4.draw();
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE); EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
EaglerAdapter.glTranslatef(0.0F, 0.0F, -2.0F); EaglerAdapter.glTranslatef(0.0F, 0.0F, -2.0F);

View File

@ -23,10 +23,10 @@ public class RenderXPOrb extends Render {
int var10 = par1EntityXPOrb.getTextureByXP(); int var10 = par1EntityXPOrb.getTextureByXP();
tex_xporb.bindTexture(); tex_xporb.bindTexture();
Tessellator var11 = Tessellator.instance; Tessellator var11 = Tessellator.instance;
float var12 = (float) (var10 % 4 * 16 + 0) / 64.0F; float var12 = (float) (var10 % 4 * 16 + 0 + 0.2f) / 64.0F;
float var13 = (float) (var10 % 4 * 16 + 16) / 64.0F; float var13 = (float) (var10 % 4 * 16 + 16 - 0.2f) / 64.0F;
float var14 = (float) (var10 / 4 * 16 + 0) / 64.0F; float var14 = (float) (var10 / 4 * 16 + 0 + 0.2f) / 64.0F;
float var15 = (float) (var10 / 4 * 16 + 16) / 64.0F; float var15 = (float) (var10 / 4 * 16 + 16 - 0.2f) / 64.0F;
float var16 = 1.0F; float var16 = 1.0F;
float var17 = 0.5F; float var17 = 0.5F;
float var18 = 0.25F; float var18 = 0.25F;

View File

@ -16,8 +16,8 @@ public class TexturedQuad {
public TexturedQuad(PositionTextureVertex[] par1ArrayOfPositionTextureVertex, Vec3 normal, int par2, int par3, int par4, int par5, float par6, float par7) { public TexturedQuad(PositionTextureVertex[] par1ArrayOfPositionTextureVertex, Vec3 normal, int par2, int par3, int par4, int par5, float par6, float par7) {
this(par1ArrayOfPositionTextureVertex); this(par1ArrayOfPositionTextureVertex);
float var8 = 0.0F / par6; float var8 = 0.2F / par6;
float var9 = 0.0F / par7; float var9 = 0.2F / par7;
par1ArrayOfPositionTextureVertex[0] = par1ArrayOfPositionTextureVertex[0].setTexturePosition((float) par4 / par6 - var8, (float) par3 / par7 + var9); par1ArrayOfPositionTextureVertex[0] = par1ArrayOfPositionTextureVertex[0].setTexturePosition((float) par4 / par6 - var8, (float) par3 / par7 + var9);
par1ArrayOfPositionTextureVertex[1] = par1ArrayOfPositionTextureVertex[1].setTexturePosition((float) par2 / par6 + var8, (float) par3 / par7 + var9); par1ArrayOfPositionTextureVertex[1] = par1ArrayOfPositionTextureVertex[1].setTexturePosition((float) par2 / par6 + var8, (float) par3 / par7 + var9);
par1ArrayOfPositionTextureVertex[2] = par1ArrayOfPositionTextureVertex[2].setTexturePosition((float) par2 / par6 + var8, (float) par5 / par7 - var9); par1ArrayOfPositionTextureVertex[2] = par1ArrayOfPositionTextureVertex[2].setTexturePosition((float) par2 / par6 + var8, (float) par5 / par7 - var9);

View File

@ -411,7 +411,7 @@ public class EaglerAdapterImpl2 {
public static final int _wGL_SRC_COLOR = SRC_COLOR; public static final int _wGL_SRC_COLOR = SRC_COLOR;
public static final int _wGL_ONE = ONE; public static final int _wGL_ONE = ONE;
public static final int _wGL_NEAREST = NEAREST; public static final int _wGL_NEAREST = NEAREST;
public static final int _wGL_CLAMP = REPEAT; public static final int _wGL_CLAMP = CLAMP_TO_EDGE;
public static final int _wGL_TEXTURE_WRAP_S = TEXTURE_WRAP_S; public static final int _wGL_TEXTURE_WRAP_S = TEXTURE_WRAP_S;
public static final int _wGL_TEXTURE_WRAP_T = TEXTURE_WRAP_T; public static final int _wGL_TEXTURE_WRAP_T = TEXTURE_WRAP_T;
public static final int _wGL_REPEAT = REPEAT; public static final int _wGL_REPEAT = REPEAT;