Working Texture Blending!
This commit is contained in:
parent
6cb12f6049
commit
55e507106c
|
@ -1,17 +1,10 @@
|
|||
package com.mojang.minecraft.render;
|
||||
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
|
||||
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3) braces deadcode
|
||||
|
||||
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;
|
||||
|
||||
|
@ -31,7 +24,7 @@ public class RenderEngine {
|
|||
imageDataB1 = GLAllocation.createDirectByteBuffer(0x100000);
|
||||
imageDataB2 = GLAllocation.createDirectByteBuffer(0x100000);
|
||||
textureList = new ArrayList<TextureFX>();
|
||||
//useMipmaps = false;
|
||||
textureBlending = false;
|
||||
options = Minecraft.settings;
|
||||
}
|
||||
|
||||
|
@ -45,11 +38,11 @@ public class RenderEngine {
|
|||
singleIntBuffer.clear();
|
||||
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||
int i = singleIntBuffer.get(0);
|
||||
//if(s.equals("/terrain.png")) {
|
||||
//useMipmaps = true;
|
||||
//}
|
||||
if(s.contains("terrain")) {
|
||||
textureBlending = true;
|
||||
}
|
||||
setupTexture(readTextureImage(texturepackbase.func_6481_a(s)), i);
|
||||
//useMipmaps = false;
|
||||
textureBlending = false;
|
||||
textureMap.put(s, Integer.valueOf(i));
|
||||
return i;
|
||||
} catch (IOException ioexception) {
|
||||
|
@ -83,25 +76,16 @@ public class RenderEngine {
|
|||
|
||||
public void setupTexture(EaglerImage bufferedimage, int i) {
|
||||
bindTexture(i);
|
||||
// if (useMipmaps) {
|
||||
// GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, EaglerAdapter.GL_NEAREST_MIPMAP_LINEAR);
|
||||
// GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, EaglerAdapter.GL_NEAREST /* GL_LINEAR */);
|
||||
// GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, EaglerAdapter.GL_TEXTURE_MAX_LEVEL, 4);
|
||||
// } else {
|
||||
if (textureBlending) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9728 /* GL_NEAREST */);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9728 /* GL_NEAREST */);
|
||||
// }
|
||||
// if (blurTexture) {
|
||||
// EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9729 /* GL_LINEAR */);
|
||||
// EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9729 /* GL_LINEAR */);
|
||||
// }
|
||||
// if (clampTexture) {
|
||||
// EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10496 /* GL_CLAMP */);
|
||||
// EaglerAdapter.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10496 /* GL_CLAMP */);
|
||||
// } else {
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */);
|
||||
// }
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */);
|
||||
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */);
|
||||
|
||||
int j = bufferedimage.w;
|
||||
int k = bufferedimage.h;
|
||||
int ai[] = bufferedimage.data;
|
||||
|
@ -127,34 +111,7 @@ public class RenderEngine {
|
|||
imageDataB1.clear();
|
||||
imageDataB1.put(abyte0);
|
||||
imageDataB1.position(0).limit(abyte0.length);
|
||||
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, 6408 /* GL_RGBA */, j, k, 0, 6408 /* GL_RGBA */,
|
||||
5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
|
||||
// if (useMipmaps) {
|
||||
// for (int i1 = 1; i1 <= 4; i1++) {
|
||||
// int k1 = j >> i1 - 1;
|
||||
// int i2 = j >> i1;
|
||||
// int k2 = k >> i1;
|
||||
// imageDataB2.clear();
|
||||
// for (int i3 = 0; i3 < i2; i3++) {
|
||||
// for (int k3 = 0; k3 < k2; k3++) {
|
||||
// int i4 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 0) * k1) * 4);
|
||||
// int k4 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 0) * k1) * 4);
|
||||
// int l4 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 1) * k1) * 4);
|
||||
// int i5 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 1) * k1) * 4);
|
||||
// int j5 = averageColor(averageColor(i4, k4), averageColor(l4, i5));
|
||||
// imageDataB2.putInt((i3 + k3 * i2) * 4, j5);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, i1, 6408 /* GL_RGBA */, i2, k2, 0, 6408 /* GL_RGBA */,
|
||||
// 5121 /* GL_UNSIGNED_BYTE */, imageDataB2);
|
||||
// ByteBuffer tmp = imageDataB1;
|
||||
// imageDataB1 = imageDataB2;
|
||||
// imageDataB2 = tmp;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, 6408 /* GL_RGBA */, j, k, 0, 6408 /* GL_RGBA */, 5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
|
||||
}
|
||||
|
||||
public void deleteTexture(int i) {
|
||||
|
@ -197,4 +154,5 @@ public class RenderEngine {
|
|||
private ByteBuffer imageDataB2;
|
||||
private java.util.List<TextureFX> textureList;
|
||||
private GameSettings options;
|
||||
private boolean textureBlending;
|
||||
}
|
Loading…
Reference in New Issue
Block a user