yee
This commit is contained in:
parent
9138a1ee09
commit
40d2195d48
|
@ -24,9 +24,6 @@ import com.mojang.minecraft.player.InputHandlerImpl;
|
|||
import com.mojang.minecraft.player.Player;
|
||||
import com.mojang.minecraft.render.*;
|
||||
import com.mojang.minecraft.render.Renderer;
|
||||
import com.mojang.minecraft.render.texture.TextureFX;
|
||||
import com.mojang.minecraft.render.texture.TextureLavaFX;
|
||||
import com.mojang.minecraft.render.texture.TextureWaterFX;
|
||||
import net.PeytonPlayz585.math.MathHelper;
|
||||
|
||||
import net.lax1dude.eaglercraft.GLAllocation;
|
||||
|
@ -443,8 +440,6 @@ public final class Minecraft implements Runnable {
|
|||
var74 = var116.yo + (var116.y - var116.yo) * var80;
|
||||
var33 = var116.zo + (var116.z - var116.zo) * var80;
|
||||
GL11.glTranslatef(-var69, -var74, -var33);
|
||||
//Frustrum var76 = FrustrumImpl.update();
|
||||
//Frustrum var100 = var76;
|
||||
Frustrum var76 = new Frustrum();
|
||||
if(field_22009_h != this.player) {
|
||||
field_22009_h = player;
|
||||
|
@ -469,7 +464,7 @@ public final class Minecraft implements Runnable {
|
|||
Collections.sort(var82.minecraft.levelRenderer.chunks, new ChunkDirtyDistanceComparator(var126));
|
||||
var98 = var101.chunks.size() - 1;
|
||||
int var105;
|
||||
if((var105 = var101.chunks.size()) > 3) {
|
||||
if((var105 = var101.chunks.size() / 2) > 3) {
|
||||
var105 = 3;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public final class Chunk {
|
|||
this.y = var3;
|
||||
this.z = var4;
|
||||
this.width = this.height = this.depth = 16;
|
||||
MathHelper.sqrt((float)(this.width * this.width + this.height * this.height + this.depth * this.depth));
|
||||
MathHelper.sqrt((float)(this.width + this.height + this.depth));
|
||||
this.baseListId = var6;
|
||||
this.setAllDirty();
|
||||
}
|
||||
|
@ -47,12 +47,10 @@ public final class Chunk {
|
|||
int var5 = this.y + this.height;
|
||||
int var6 = this.z + this.depth;
|
||||
|
||||
int var7;
|
||||
for(var7 = 0; var7 < 2; ++var7) {
|
||||
this.dirty[var7] = true;
|
||||
}
|
||||
this.dirty[1] = true;
|
||||
this.dirty[2] = true;
|
||||
|
||||
for(var7 = 0; var7 < 2; ++var7) {
|
||||
for(int var7 = 0; var7 < 2; ++var7) {
|
||||
boolean var8 = false;
|
||||
boolean var9 = false;
|
||||
GL11.glNewList(this.baseListId + var7, 4864);
|
||||
|
|
|
@ -17,7 +17,7 @@ public final class LevelRenderer {
|
|||
|
||||
public Level level;
|
||||
public int listId;
|
||||
public IntBuffer buffer = GLAllocation.createDirectIntBuffer(65536);
|
||||
public IntBuffer buffer = GLAllocation.createDirectIntBuffer(4096);
|
||||
public List<Chunk> chunks = new ArrayList<Chunk>();
|
||||
private Chunk[] loadQueue;
|
||||
public Chunk[] chunkCache;
|
||||
|
@ -26,7 +26,7 @@ public final class LevelRenderer {
|
|||
private int zChunks;
|
||||
private int baseListId;
|
||||
public Minecraft minecraft;
|
||||
private int[] chunkDataCache = new int[4096];
|
||||
private int[] chunkDataCache = new int[1024];
|
||||
public int ticks = 0;
|
||||
private float lastLoadX = -9999.0F;
|
||||
private float lastLoadY = -9999.0F;
|
||||
|
@ -37,7 +37,7 @@ public final class LevelRenderer {
|
|||
public LevelRenderer(Minecraft var1) {
|
||||
this.minecraft = var1;
|
||||
this.listId = GL11.glGenLists(2);
|
||||
this.baseListId = GL11.glGenLists(4096 << 6 << 1);
|
||||
this.baseListId = GL11.glGenLists(4096);
|
||||
}
|
||||
|
||||
public final void refresh() {
|
||||
|
@ -196,7 +196,6 @@ public final class LevelRenderer {
|
|||
this.buffer.put(this.chunkDataCache, 0, var6);
|
||||
this.buffer.flip();
|
||||
if(this.buffer.remaining() > 0) {
|
||||
new TextureLocation("/terrain.png").bindTexture();
|
||||
GL11.glCallLists(this.buffer);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
package com.mojang.minecraft.render;
|
||||
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.minecraft.GameSettings;
|
||||
import com.mojang.minecraft.Minecraft;
|
||||
import com.mojang.minecraft.render.texture.TextureFX;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerImage;
|
||||
import net.lax1dude.eaglercraft.GLAllocation;
|
||||
|
@ -23,22 +15,21 @@ import net.lax1dude.eaglercraft.GLAllocation;
|
|||
public class RenderEngine {
|
||||
|
||||
public RenderEngine() {
|
||||
textureMap = new HashMap<String, Integer>();
|
||||
textureNameToImageMap = new HashMap<Integer, EaglerImage>();
|
||||
// textureMap = new HashMap<String, Integer>();
|
||||
// textureNameToImageMap = new HashMap<Integer, EaglerImage>();
|
||||
singleIntBuffer = GLAllocation.createDirectIntBuffer(1);
|
||||
imageDataB1 = GLAllocation.createDirectByteBuffer(0x100000);
|
||||
imageDataB2 = GLAllocation.createDirectByteBuffer(0x100000);
|
||||
textureList = new ArrayList<TextureFX>();
|
||||
// imageDataB2 = GLAllocation.createDirectByteBuffer(0x100000);
|
||||
textureBlending = false;
|
||||
options = Minecraft.settings;
|
||||
}
|
||||
|
||||
public int getTexture(String s) {
|
||||
TextureBase texturepackbase = new TextureBase();
|
||||
Integer integer = (Integer) textureMap.get(s);
|
||||
if (integer != null) {
|
||||
return integer.intValue();
|
||||
}
|
||||
// TextureBase texturepackbase = new TextureBase();
|
||||
// Integer integer = (Integer) textureMap.get(s);
|
||||
// if (integer != null) {
|
||||
// return integer.intValue();
|
||||
// }
|
||||
try {
|
||||
singleIntBuffer.clear();
|
||||
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||
|
@ -46,9 +37,9 @@ public class RenderEngine {
|
|||
if(s.equals("/terrain.png") || s.contains("arrow") || s.contains("default")) {
|
||||
textureBlending = true;
|
||||
}
|
||||
setupTexture(readTextureImage(texturepackbase.func_6481_a(s)), i);
|
||||
setupTexture(readTextureImage(TextureBase.func_6481_a(s)), i);
|
||||
textureBlending = false;
|
||||
textureMap.put(s, Integer.valueOf(i));
|
||||
// textureMap.put(s, Integer.valueOf(i));
|
||||
return i;
|
||||
} catch (IOException ioexception) {
|
||||
throw new RuntimeException("!!");
|
||||
|
@ -62,7 +53,7 @@ public class RenderEngine {
|
|||
textureBlending = true;
|
||||
setupTexture(bufferedimage, i);
|
||||
textureBlending = false;
|
||||
textureNameToImageMap.put(Integer.valueOf(i), bufferedimage);
|
||||
//textureNameToImageMap.put(Integer.valueOf(i), bufferedimage);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -103,30 +94,13 @@ public class RenderEngine {
|
|||
imageDataB1.clear();
|
||||
imageDataB1.put(abyte0);
|
||||
imageDataB1.position(0).limit(abyte0.length);
|
||||
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, GL11._wGL_RGBA8 /* GL_RGBA */, j, k, 0, GL11._wGL_RGBA8 /* GL_RGBA */,
|
||||
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, GL11._wGL_RGBA8 /* GL_RGBA */, j, k, 0, GL11.GL_RGBA /* GL_RGBA */,
|
||||
5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
public void deleteTexture(int i) {
|
||||
GL11.glDeleteTextures(i);
|
||||
}
|
||||
|
||||
public int getTextureForDownloadableImage(String s, String s1) {
|
||||
return getTexture("/mob/char.png");
|
||||
}
|
||||
|
||||
public void registerTextureFX(TextureFX texturefx) {
|
||||
textureList.add(texturefx);
|
||||
texturefx.animate();
|
||||
}
|
||||
|
||||
private int averageColor(int i, int j) {
|
||||
int k = (i & 0xff000000) >> 24 & 0xff;
|
||||
int l = (j & 0xff000000) >> 24 & 0xff;
|
||||
return ((k + l >> 1) << 24) + ((i & 0xfefefe) + (j & 0xfefefe) >> 1);
|
||||
|
||||
}
|
||||
|
||||
private EaglerImage readTextureImage(byte[] inputstream) throws IOException {
|
||||
return GL11.loadPNG(inputstream);
|
||||
|
@ -141,12 +115,8 @@ public class RenderEngine {
|
|||
}
|
||||
}
|
||||
|
||||
public static HashMap<String, Integer> textureMap;
|
||||
private HashMap<Integer, EaglerImage> textureNameToImageMap;
|
||||
private IntBuffer singleIntBuffer;
|
||||
private ByteBuffer imageDataB1;
|
||||
private ByteBuffer imageDataB2;
|
||||
private java.util.List<TextureFX> textureList;
|
||||
private GameSettings options;
|
||||
private boolean textureBlending;
|
||||
}
|
|
@ -8,7 +8,7 @@ public class TextureBase {
|
|||
//This overrides the default Java constructor insuring non-instability
|
||||
}
|
||||
|
||||
public byte[] func_6481_a(String s) {
|
||||
public static byte[] func_6481_a(String s) {
|
||||
return GL11.loadResourceBytes(s);
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.mojang.minecraft.render.texture;
|
||||
|
||||
public class TextureFX
|
||||
{
|
||||
public TextureFX(int textureID)
|
||||
{
|
||||
this.textureId = textureID;
|
||||
}
|
||||
|
||||
public byte[] textureData = new byte[1024];
|
||||
public int textureId;
|
||||
public boolean anaglyph = false;
|
||||
|
||||
public void animate()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
package com.mojang.minecraft.render.texture;
|
||||
|
||||
import com.mojang.minecraft.level.tile.Block;
|
||||
import com.mojang.minecraft.render.texture.TextureFX;
|
||||
import net.PeytonPlayz585.math.MathHelper;
|
||||
|
||||
public final class TextureLavaFX extends TextureFX {
|
||||
|
||||
private float[] red = new float[256];
|
||||
private float[] green = new float[256];
|
||||
private float[] blue = new float[256];
|
||||
private float[] alpha = new float[256];
|
||||
|
||||
|
||||
public TextureLavaFX() {
|
||||
super(Block.LAVA.textureId);
|
||||
}
|
||||
|
||||
public final void animate() {
|
||||
int var1;
|
||||
int var2;
|
||||
float var3;
|
||||
int var5;
|
||||
int var6;
|
||||
int var7;
|
||||
int var8;
|
||||
int var9;
|
||||
for(var1 = 0; var1 < 16; ++var1) {
|
||||
for(var2 = 0; var2 < 16; ++var2) {
|
||||
var3 = 0.0F;
|
||||
int var4 = (int)(MathHelper.sin((float)var2 * 3.1415927F * 2.0F / 16.0F) * 1.2F);
|
||||
var5 = (int)(MathHelper.sin((float)var1 * 3.1415927F * 2.0F / 16.0F) * 1.2F);
|
||||
|
||||
for(var6 = var1 - 1; var6 <= var1 + 1; ++var6) {
|
||||
for(var7 = var2 - 1; var7 <= var2 + 1; ++var7) {
|
||||
var8 = var6 + var4 & 15;
|
||||
var9 = var7 + var5 & 15;
|
||||
var3 += this.red[var8 + (var9 << 4)];
|
||||
}
|
||||
}
|
||||
|
||||
this.green[var1 + (var2 << 4)] = var3 / 10.0F + (this.blue[(var1 & 15) + ((var2 & 15) << 4)] + this.blue[(var1 + 1 & 15) + ((var2 & 15) << 4)] + this.blue[(var1 + 1 & 15) + ((var2 + 1 & 15) << 4)] + this.blue[(var1 & 15) + ((var2 + 1 & 15) << 4)]) / 4.0F * 0.8F;
|
||||
this.blue[var1 + (var2 << 4)] += this.alpha[var1 + (var2 << 4)] * 0.01F;
|
||||
if(this.blue[var1 + (var2 << 4)] < 0.0F) {
|
||||
this.blue[var1 + (var2 << 4)] = 0.0F;
|
||||
}
|
||||
|
||||
this.alpha[var1 + (var2 << 4)] -= 0.06F;
|
||||
if(Math.random() < 0.005D) {
|
||||
this.alpha[var1 + (var2 << 4)] = 1.5F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float[] var10 = this.green;
|
||||
this.green = this.red;
|
||||
this.red = var10;
|
||||
|
||||
for(var2 = 0; var2 < 256; ++var2) {
|
||||
if((var3 = this.red[var2] * 2.0F) > 1.0F) {
|
||||
var3 = 1.0F;
|
||||
}
|
||||
|
||||
if(var3 < 0.0F) {
|
||||
var3 = 0.0F;
|
||||
}
|
||||
|
||||
var5 = (int)(var3 * 100.0F + 155.0F);
|
||||
var6 = (int)(var3 * var3 * 255.0F);
|
||||
var7 = (int)(var3 * var3 * var3 * var3 * 128.0F);
|
||||
if(this.anaglyph) {
|
||||
var8 = (var5 * 30 + var6 * 59 + var7 * 11) / 100;
|
||||
var9 = (var5 * 30 + var6 * 70) / 100;
|
||||
var1 = (var5 * 30 + var7 * 70) / 100;
|
||||
var5 = var8;
|
||||
var6 = var9;
|
||||
var7 = var1;
|
||||
}
|
||||
|
||||
this.textureData[var2 << 2] = (byte)var5;
|
||||
this.textureData[(var2 << 2) + 1] = (byte)var6;
|
||||
this.textureData[(var2 << 2) + 2] = (byte)var7;
|
||||
this.textureData[(var2 << 2) + 3] = -1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
package com.mojang.minecraft.render.texture;
|
||||
|
||||
import com.mojang.minecraft.level.tile.Block;
|
||||
import com.mojang.minecraft.render.texture.TextureFX;
|
||||
|
||||
public final class TextureWaterFX extends TextureFX {
|
||||
|
||||
private float[] red = new float[256];
|
||||
private float[] blue = new float[256];
|
||||
private float[] green = new float[256];
|
||||
private float[] alpha = new float[256];
|
||||
private int updates = 0;
|
||||
|
||||
|
||||
public TextureWaterFX() {
|
||||
super(Block.WATER.textureId);
|
||||
}
|
||||
|
||||
public final void animate() {
|
||||
++this.updates;
|
||||
|
||||
int var1;
|
||||
int var2;
|
||||
float var3;
|
||||
int var4;
|
||||
int var5;
|
||||
int var6;
|
||||
for(var1 = 0; var1 < 16; ++var1) {
|
||||
for(var2 = 0; var2 < 16; ++var2) {
|
||||
var3 = 0.0F;
|
||||
|
||||
for(var4 = var1 - 1; var4 <= var1 + 1; ++var4) {
|
||||
var5 = var4 & 15;
|
||||
var6 = var2 & 15;
|
||||
var3 += this.red[var5 + (var6 << 4)];
|
||||
}
|
||||
|
||||
this.blue[var1 + (var2 << 4)] = var3 / 3.3F + this.green[var1 + (var2 << 4)] * 0.8F;
|
||||
}
|
||||
}
|
||||
|
||||
for(var1 = 0; var1 < 16; ++var1) {
|
||||
for(var2 = 0; var2 < 16; ++var2) {
|
||||
this.green[var1 + (var2 << 4)] += this.alpha[var1 + (var2 << 4)] * 0.05F;
|
||||
if(this.green[var1 + (var2 << 4)] < 0.0F) {
|
||||
this.green[var1 + (var2 << 4)] = 0.0F;
|
||||
}
|
||||
|
||||
this.alpha[var1 + (var2 << 4)] -= 0.1F;
|
||||
if(Math.random() < 0.05D) {
|
||||
this.alpha[var1 + (var2 << 4)] = 0.5F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float[] var8 = this.blue;
|
||||
this.blue = this.red;
|
||||
this.red = var8;
|
||||
|
||||
for(var2 = 0; var2 < 256; ++var2) {
|
||||
if((var3 = this.red[var2]) > 1.0F) {
|
||||
var3 = 1.0F;
|
||||
}
|
||||
|
||||
if(var3 < 0.0F) {
|
||||
var3 = 0.0F;
|
||||
}
|
||||
|
||||
float var9 = var3 * var3;
|
||||
var5 = (int)(32.0F + var9 * 32.0F);
|
||||
var6 = (int)(50.0F + var9 * 64.0F);
|
||||
var1 = 255;
|
||||
int var10 = (int)(146.0F + var9 * 50.0F);
|
||||
if(this.anaglyph) {
|
||||
var1 = (var5 * 30 + var6 * 59 + 2805) / 100;
|
||||
var4 = (var5 * 30 + var6 * 70) / 100;
|
||||
int var7 = (var5 * 30 + 17850) / 100;
|
||||
var5 = var1;
|
||||
var6 = var4;
|
||||
var1 = var7;
|
||||
}
|
||||
|
||||
this.textureData[var2 << 2] = (byte)var5;
|
||||
this.textureData[(var2 << 2) + 1] = (byte)var6;
|
||||
this.textureData[(var2 << 2) + 2] = (byte)var1;
|
||||
this.textureData[(var2 << 2) + 3] = (byte)var10;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -111,9 +111,9 @@ public class Tessellator {
|
|||
GL11.glEnableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if (this.hasNormals) {
|
||||
GL11.glEnableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||
}
|
||||
// if (this.hasNormals) {
|
||||
// GL11.glEnableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||
// }
|
||||
|
||||
GL11.glDrawArrays(7, 0, this.vertexCount, Int32Array.create(intBuffer.getBuffer(), 0, this.vertexCount * 8));
|
||||
|
||||
|
@ -125,9 +125,9 @@ public class Tessellator {
|
|||
GL11.glDisableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if (this.hasNormals) {
|
||||
GL11.glDisableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||
}
|
||||
// if (this.hasNormals) {
|
||||
// GL11.glDisableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||
// }
|
||||
}
|
||||
|
||||
int var1 = this.rawBufferIndex * 4;
|
||||
|
@ -319,9 +319,9 @@ public class Tessellator {
|
|||
public void setNormal(float par1, float par2, float par3) {
|
||||
this.hasNormals = true;
|
||||
float len = (float) Math.sqrt(par1 * par1 + par2 * par2 + par3 * par3);
|
||||
int var4 = (int)((par1 / len) * 126.0F) + 126;
|
||||
int var5 = (int)((par2 / len) * 126.0F) + 126;
|
||||
int var6 = (int)((par3 / len) * 126.0F) + 126;
|
||||
int var4 = (int)((par1 / len) * 125.0F) + 125;
|
||||
int var5 = (int)((par2 / len) * 125.0F) + 125;
|
||||
int var6 = (int)((par3 / len) * 125.0F) + 125;
|
||||
this.normal = var4 & 255 | (var5 & 255) << 8 | (var6 & 255) << 16;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user