Fix graphical glitches around world border
This commit is contained in:
parent
d2d90d4887
commit
57638cdcd2
File diff suppressed because one or more lines are too long
|
@ -80,7 +80,6 @@ public final class Minecraft implements Runnable {
|
||||||
public boolean raining;
|
public boolean raining;
|
||||||
private static Tessellator tessellator = Tessellator.instance;
|
private static Tessellator tessellator = Tessellator.instance;
|
||||||
public static Minecraft minecraft;
|
public static Minecraft minecraft;
|
||||||
public Entity field_22009_h;
|
|
||||||
public int timeSinceLastSaved = 0;
|
public int timeSinceLastSaved = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -441,24 +440,13 @@ public final class Minecraft implements Runnable {
|
||||||
var74 = var116.yo + (var116.y - var116.yo) * var80;
|
var74 = var116.yo + (var116.y - var116.yo) * var80;
|
||||||
var33 = var116.zo + (var116.z - var116.zo) * var80;
|
var33 = var116.zo + (var116.z - var116.zo) * var80;
|
||||||
GL11.glTranslatef(-var69, -var74, -var33);
|
GL11.glTranslatef(-var69, -var74, -var33);
|
||||||
Frustrum var76 = new Frustrum();
|
Frustrum var76 = FrustrumImpl.update();
|
||||||
if(field_22009_h != this.player) {
|
Frustrum var100 = var76;
|
||||||
field_22009_h = player;
|
|
||||||
float f = this.timer.elapsedTicks;
|
|
||||||
double d = field_22009_h.x + (field_22009_h.x - field_22009_h.x) * (double) f;
|
|
||||||
double d1 = field_22009_h.y + (field_22009_h.y - field_22009_h.y) * (double) f;
|
|
||||||
double d2 = field_22009_h.z + (field_22009_h.z - field_22009_h.z) * (double) f;
|
|
||||||
ClippingHelperImplementation.getInstance();
|
|
||||||
Frustrum frustrum = new Frustrum();
|
|
||||||
frustrum.setPosition(d, d1, d2);
|
|
||||||
var76 = frustrum;
|
|
||||||
System.out.println("yee");
|
|
||||||
}
|
|
||||||
LevelRenderer var101 = var82.minecraft.levelRenderer;
|
LevelRenderer var101 = var82.minecraft.levelRenderer;
|
||||||
|
|
||||||
int var98;
|
int var98;
|
||||||
for(var98 = 0; var98 < var101.chunkCache.length; ++var98) {
|
for(var98 = 0; var98 < var101.chunkCache.length; ++var98) {
|
||||||
var101.chunkCache[var98].clip(var76);
|
var101.chunkCache[var98].clip(var100);
|
||||||
}
|
}
|
||||||
|
|
||||||
var101 = var82.minecraft.levelRenderer;
|
var101 = var82.minecraft.levelRenderer;
|
||||||
|
|
|
@ -196,42 +196,42 @@ public class BlockMap implements Serializable {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var19.clippingHelper.frustum[var20][0] * var18 + var19.clippingHelper.frustum[var20][1] * var13 + var19.clippingHelper.frustum[var20][2] * var14 + var19.clippingHelper.frustum[var20][3] <= 0.0F) {
|
if(var19.frustrum[var20][0] * var18 + var19.frustrum[var20][1] * var13 + var19.frustrum[var20][2] * var14 + var19.frustrum[var20][3] <= 0.0F) {
|
||||||
var10000 = false;
|
var10000 = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var19.clippingHelper.frustum[var20][0] * var15 + var19.clippingHelper.frustum[var20][1] * var13 + var19.clippingHelper.frustum[var20][2] * var14 + var19.clippingHelper.frustum[var20][3] <= 0.0F) {
|
if(var19.frustrum[var20][0] * var15 + var19.frustrum[var20][1] * var13 + var19.frustrum[var20][2] * var14 + var19.frustrum[var20][3] <= 0.0F) {
|
||||||
var10000 = false;
|
var10000 = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var19.clippingHelper.frustum[var20][0] * var18 + var19.clippingHelper.frustum[var20][1] * var17 + var19.clippingHelper.frustum[var20][2] * var14 + var19.clippingHelper.frustum[var20][3] <= 0.0F) {
|
if(var19.frustrum[var20][0] * var18 + var19.frustrum[var20][1] * var17 + var19.frustrum[var20][2] * var14 + var19.frustrum[var20][3] <= 0.0F) {
|
||||||
var10000 = false;
|
var10000 = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var19.clippingHelper.frustum[var20][0] * var15 + var19.clippingHelper.frustum[var20][1] * var17 + var19.clippingHelper.frustum[var20][2] * var14 + var19.clippingHelper.frustum[var20][3] <= 0.0F) {
|
if(var19.frustrum[var20][0] * var15 + var19.frustrum[var20][1] * var17 + var19.frustrum[var20][2] * var14 + var19.frustrum[var20][3] <= 0.0F) {
|
||||||
var10000 = false;
|
var10000 = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var19.clippingHelper.frustum[var20][0] * var18 + var19.clippingHelper.frustum[var20][1] * var13 + var19.clippingHelper.frustum[var20][2] * var16 + var19.clippingHelper.frustum[var20][3] <= 0.0F) {
|
if(var19.frustrum[var20][0] * var18 + var19.frustrum[var20][1] * var13 + var19.frustrum[var20][2] * var16 + var19.frustrum[var20][3] <= 0.0F) {
|
||||||
var10000 = false;
|
var10000 = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var19.clippingHelper.frustum[var20][0] * var15 + var19.clippingHelper.frustum[var20][1] * var13 + var19.clippingHelper.frustum[var20][2] * var16 + var19.clippingHelper.frustum[var20][3] <= 0.0F) {
|
if(var19.frustrum[var20][0] * var15 + var19.frustrum[var20][1] * var13 + var19.frustrum[var20][2] * var16 + var19.frustrum[var20][3] <= 0.0F) {
|
||||||
var10000 = false;
|
var10000 = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var19.clippingHelper.frustum[var20][0] * var18 + var19.clippingHelper.frustum[var20][1] * var17 + var19.clippingHelper.frustum[var20][2] * var16 + var19.clippingHelper.frustum[var20][3] <= 0.0F) {
|
if(var19.frustrum[var20][0] * var18 + var19.frustrum[var20][1] * var17 + var19.frustrum[var20][2] * var16 + var19.frustrum[var20][3] <= 0.0F) {
|
||||||
var10000 = false;
|
var10000 = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var19.clippingHelper.frustum[var20][0] * var15 + var19.clippingHelper.frustum[var20][1] * var17 + var19.clippingHelper.frustum[var20][2] * var16 + var19.clippingHelper.frustum[var20][3] <= 0.0F) {
|
if(var19.frustrum[var20][0] * var15 + var19.frustrum[var20][1] * var17 + var19.frustrum[var20][2] * var16 + var19.frustrum[var20][3] <= 0.0F) {
|
||||||
var10000 = false;
|
var10000 = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.mojang.minecraft.render;
|
package com.mojang.minecraft.render;
|
||||||
|
|
||||||
import com.mojang.minecraft.Minecraft;
|
|
||||||
import com.mojang.minecraft.level.Level;
|
import com.mojang.minecraft.level.Level;
|
||||||
import com.mojang.minecraft.level.tile.Block;
|
import com.mojang.minecraft.level.tile.Block;
|
||||||
import com.mojang.minecraft.player.Player;
|
import com.mojang.minecraft.player.Player;
|
||||||
import com.mojang.minecraft.render.Frustrum;
|
import com.mojang.minecraft.render.Frustrum;
|
||||||
|
|
||||||
import net.PeytonPlayz585.math.MathHelper;
|
import net.PeytonPlayz585.math.MathHelper;
|
||||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public final class Chunk {
|
||||||
this.y = var3;
|
this.y = var3;
|
||||||
this.z = var4;
|
this.z = var4;
|
||||||
this.width = this.height = this.depth = 16;
|
this.width = this.height = this.depth = 16;
|
||||||
MathHelper.sqrt((float)(this.width + this.height + this.depth));
|
MathHelper.sqrt((float)(this.width * this.width + this.height * this.height + this.depth * this.depth));
|
||||||
this.baseListId = var6;
|
this.baseListId = var6;
|
||||||
this.setAllDirty();
|
this.setAllDirty();
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,12 @@ public final class Chunk {
|
||||||
int var5 = this.y + this.height;
|
int var5 = this.y + this.height;
|
||||||
int var6 = this.z + this.depth;
|
int var6 = this.z + this.depth;
|
||||||
|
|
||||||
this.dirty[1] = true;
|
int var7;
|
||||||
this.dirty[2] = true;
|
for(var7 = 0; var7 < 2; ++var7) {
|
||||||
|
this.dirty[var7] = true;
|
||||||
|
}
|
||||||
|
|
||||||
for(int var7 = 0; var7 < 2; ++var7) {
|
for(var7 = 0; var7 < 2; ++var7) {
|
||||||
boolean var8 = false;
|
boolean var8 = false;
|
||||||
boolean var9 = false;
|
boolean var9 = false;
|
||||||
GL11.glNewList(this.baseListId + var7, 4864);
|
GL11.glNewList(this.baseListId + var7, 4864);
|
||||||
|
|
|
@ -23,9 +23,9 @@ public class ChunkDistanceComparator implements Comparator
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
} else if(sqDist > otherSqDist) {
|
} else if(sqDist > otherSqDist) {
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return -1;
|
return -1;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
package com.mojang.minecraft.render;
|
|
||||||
|
|
||||||
public class ClippingHelper {
|
|
||||||
|
|
||||||
public ClippingHelper() {
|
|
||||||
frustum = new float[16][16];
|
|
||||||
projectionMatrix = new float[16];
|
|
||||||
modelviewMatrix = new float[16];
|
|
||||||
clippingMatrix = new float[16];
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBoxInFrustum(double d, double d1, double d2, double d3, double d4, double d5) {
|
|
||||||
for (int i = 0; i < 6; i++) {
|
|
||||||
if ((double) frustum[i][0] * d + (double) frustum[i][1] * d1 + (double) frustum[i][2] * d2
|
|
||||||
+ (double) frustum[i][3] <= 0.0D
|
|
||||||
&& (double) frustum[i][0] * d3 + (double) frustum[i][1] * d1 + (double) frustum[i][2] * d2
|
|
||||||
+ (double) frustum[i][3] <= 0.0D
|
|
||||||
&& (double) frustum[i][0] * d + (double) frustum[i][1] * d4 + (double) frustum[i][2] * d2
|
|
||||||
+ (double) frustum[i][3] <= 0.0D
|
|
||||||
&& (double) frustum[i][0] * d3 + (double) frustum[i][1] * d4 + (double) frustum[i][2] * d2
|
|
||||||
+ (double) frustum[i][3] <= 0.0D
|
|
||||||
&& (double) frustum[i][0] * d + (double) frustum[i][1] * d1 + (double) frustum[i][2] * d5
|
|
||||||
+ (double) frustum[i][3] <= 0.0D
|
|
||||||
&& (double) frustum[i][0] * d3 + (double) frustum[i][1] * d1 + (double) frustum[i][2] * d5
|
|
||||||
+ (double) frustum[i][3] <= 0.0D
|
|
||||||
&& (double) frustum[i][0] * d + (double) frustum[i][1] * d4 + (double) frustum[i][2] * d5
|
|
||||||
+ (double) frustum[i][3] <= 0.0D
|
|
||||||
&& (double) frustum[i][0] * d3 + (double) frustum[i][1] * d4 + (double) frustum[i][2] * d5
|
|
||||||
+ (double) frustum[i][3] <= 0.0D) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float frustum[][];
|
|
||||||
public float projectionMatrix[];
|
|
||||||
public float modelviewMatrix[];
|
|
||||||
public float clippingMatrix[];
|
|
||||||
}
|
|
|
@ -1,114 +0,0 @@
|
||||||
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.nio.FloatBuffer;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import net.PeytonPlayz585.math.MathHelper;
|
|
||||||
import net.lax1dude.eaglercraft.GLAllocation;
|
|
||||||
|
|
||||||
public class ClippingHelperImplementation extends ClippingHelper {
|
|
||||||
|
|
||||||
public ClippingHelperImplementation() {
|
|
||||||
projectionMatrixBuffer = GLAllocation.createDirectFloatBuffer(16);
|
|
||||||
modelviewMatrixBuffer = GLAllocation.createDirectFloatBuffer(16);
|
|
||||||
field_1691_h = GLAllocation.createDirectFloatBuffer(16);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ClippingHelper getInstance() {
|
|
||||||
instance.init();
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void normalize(float af[][], int i) {
|
|
||||||
float f = MathHelper.sqrt(af[i][0] * af[i][0] + af[i][1] * af[i][1] + af[i][2] * af[i][2]);
|
|
||||||
af[i][0] /= f;
|
|
||||||
af[i][1] /= f;
|
|
||||||
af[i][2] /= f;
|
|
||||||
af[i][3] /= f;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init() {
|
|
||||||
projectionMatrixBuffer.clear();
|
|
||||||
modelviewMatrixBuffer.clear();
|
|
||||||
field_1691_h.clear();
|
|
||||||
GL11.glGetFloat(2983 /* GL_PROJECTION_MATRIX */, projectionMatrixBuffer);
|
|
||||||
GL11.glGetFloat(2982 /* GL_MODELVIEW_MATRIX */, modelviewMatrixBuffer);
|
|
||||||
projectionMatrixBuffer.flip().limit(16);
|
|
||||||
projectionMatrixBuffer.get(projectionMatrix);
|
|
||||||
modelviewMatrixBuffer.flip().limit(16);
|
|
||||||
modelviewMatrixBuffer.get(modelviewMatrix);
|
|
||||||
clippingMatrix[0] = modelviewMatrix[0] * projectionMatrix[0] + modelviewMatrix[1] * projectionMatrix[4]
|
|
||||||
+ modelviewMatrix[2] * projectionMatrix[8] + modelviewMatrix[3] * projectionMatrix[12];
|
|
||||||
clippingMatrix[1] = modelviewMatrix[0] * projectionMatrix[1] + modelviewMatrix[1] * projectionMatrix[5]
|
|
||||||
+ modelviewMatrix[2] * projectionMatrix[9] + modelviewMatrix[3] * projectionMatrix[13];
|
|
||||||
clippingMatrix[2] = modelviewMatrix[0] * projectionMatrix[2] + modelviewMatrix[1] * projectionMatrix[6]
|
|
||||||
+ modelviewMatrix[2] * projectionMatrix[10] + modelviewMatrix[3] * projectionMatrix[14];
|
|
||||||
clippingMatrix[3] = modelviewMatrix[0] * projectionMatrix[3] + modelviewMatrix[1] * projectionMatrix[7]
|
|
||||||
+ modelviewMatrix[2] * projectionMatrix[11] + modelviewMatrix[3] * projectionMatrix[15];
|
|
||||||
clippingMatrix[4] = modelviewMatrix[4] * projectionMatrix[0] + modelviewMatrix[5] * projectionMatrix[4]
|
|
||||||
+ modelviewMatrix[6] * projectionMatrix[8] + modelviewMatrix[7] * projectionMatrix[12];
|
|
||||||
clippingMatrix[5] = modelviewMatrix[4] * projectionMatrix[1] + modelviewMatrix[5] * projectionMatrix[5]
|
|
||||||
+ modelviewMatrix[6] * projectionMatrix[9] + modelviewMatrix[7] * projectionMatrix[13];
|
|
||||||
clippingMatrix[6] = modelviewMatrix[4] * projectionMatrix[2] + modelviewMatrix[5] * projectionMatrix[6]
|
|
||||||
+ modelviewMatrix[6] * projectionMatrix[10] + modelviewMatrix[7] * projectionMatrix[14];
|
|
||||||
clippingMatrix[7] = modelviewMatrix[4] * projectionMatrix[3] + modelviewMatrix[5] * projectionMatrix[7]
|
|
||||||
+ modelviewMatrix[6] * projectionMatrix[11] + modelviewMatrix[7] * projectionMatrix[15];
|
|
||||||
clippingMatrix[8] = modelviewMatrix[8] * projectionMatrix[0] + modelviewMatrix[9] * projectionMatrix[4]
|
|
||||||
+ modelviewMatrix[10] * projectionMatrix[8] + modelviewMatrix[11] * projectionMatrix[12];
|
|
||||||
clippingMatrix[9] = modelviewMatrix[8] * projectionMatrix[1] + modelviewMatrix[9] * projectionMatrix[5]
|
|
||||||
+ modelviewMatrix[10] * projectionMatrix[9] + modelviewMatrix[11] * projectionMatrix[13];
|
|
||||||
clippingMatrix[10] = modelviewMatrix[8] * projectionMatrix[2] + modelviewMatrix[9] * projectionMatrix[6]
|
|
||||||
+ modelviewMatrix[10] * projectionMatrix[10] + modelviewMatrix[11] * projectionMatrix[14];
|
|
||||||
clippingMatrix[11] = modelviewMatrix[8] * projectionMatrix[3] + modelviewMatrix[9] * projectionMatrix[7]
|
|
||||||
+ modelviewMatrix[10] * projectionMatrix[11] + modelviewMatrix[11] * projectionMatrix[15];
|
|
||||||
clippingMatrix[12] = modelviewMatrix[12] * projectionMatrix[0] + modelviewMatrix[13] * projectionMatrix[4]
|
|
||||||
+ modelviewMatrix[14] * projectionMatrix[8] + modelviewMatrix[15] * projectionMatrix[12];
|
|
||||||
clippingMatrix[13] = modelviewMatrix[12] * projectionMatrix[1] + modelviewMatrix[13] * projectionMatrix[5]
|
|
||||||
+ modelviewMatrix[14] * projectionMatrix[9] + modelviewMatrix[15] * projectionMatrix[13];
|
|
||||||
clippingMatrix[14] = modelviewMatrix[12] * projectionMatrix[2] + modelviewMatrix[13] * projectionMatrix[6]
|
|
||||||
+ modelviewMatrix[14] * projectionMatrix[10] + modelviewMatrix[15] * projectionMatrix[14];
|
|
||||||
clippingMatrix[15] = modelviewMatrix[12] * projectionMatrix[3] + modelviewMatrix[13] * projectionMatrix[7]
|
|
||||||
+ modelviewMatrix[14] * projectionMatrix[11] + modelviewMatrix[15] * projectionMatrix[15];
|
|
||||||
frustum[0][0] = clippingMatrix[3] - clippingMatrix[0];
|
|
||||||
frustum[0][1] = clippingMatrix[7] - clippingMatrix[4];
|
|
||||||
frustum[0][2] = clippingMatrix[11] - clippingMatrix[8];
|
|
||||||
frustum[0][3] = clippingMatrix[15] - clippingMatrix[12];
|
|
||||||
normalize(frustum, 0);
|
|
||||||
frustum[1][0] = clippingMatrix[3] + clippingMatrix[0];
|
|
||||||
frustum[1][1] = clippingMatrix[7] + clippingMatrix[4];
|
|
||||||
frustum[1][2] = clippingMatrix[11] + clippingMatrix[8];
|
|
||||||
frustum[1][3] = clippingMatrix[15] + clippingMatrix[12];
|
|
||||||
normalize(frustum, 1);
|
|
||||||
frustum[2][0] = clippingMatrix[3] + clippingMatrix[1];
|
|
||||||
frustum[2][1] = clippingMatrix[7] + clippingMatrix[5];
|
|
||||||
frustum[2][2] = clippingMatrix[11] + clippingMatrix[9];
|
|
||||||
frustum[2][3] = clippingMatrix[15] + clippingMatrix[13];
|
|
||||||
normalize(frustum, 2);
|
|
||||||
frustum[3][0] = clippingMatrix[3] - clippingMatrix[1];
|
|
||||||
frustum[3][1] = clippingMatrix[7] - clippingMatrix[5];
|
|
||||||
frustum[3][2] = clippingMatrix[11] - clippingMatrix[9];
|
|
||||||
frustum[3][3] = clippingMatrix[15] - clippingMatrix[13];
|
|
||||||
normalize(frustum, 3);
|
|
||||||
frustum[4][0] = clippingMatrix[3] - clippingMatrix[2];
|
|
||||||
frustum[4][1] = clippingMatrix[7] - clippingMatrix[6];
|
|
||||||
frustum[4][2] = clippingMatrix[11] - clippingMatrix[10];
|
|
||||||
frustum[4][3] = clippingMatrix[15] - clippingMatrix[14];
|
|
||||||
normalize(frustum, 4);
|
|
||||||
frustum[5][0] = clippingMatrix[3] + clippingMatrix[2];
|
|
||||||
frustum[5][1] = clippingMatrix[7] + clippingMatrix[6];
|
|
||||||
frustum[5][2] = clippingMatrix[11] + clippingMatrix[10];
|
|
||||||
frustum[5][3] = clippingMatrix[15] + clippingMatrix[14];
|
|
||||||
normalize(frustum, 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ClippingHelperImplementation instance = new ClippingHelperImplementation();
|
|
||||||
private FloatBuffer projectionMatrixBuffer;
|
|
||||||
private FloatBuffer modelviewMatrixBuffer;
|
|
||||||
private FloatBuffer field_1691_h;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,29 +1,21 @@
|
||||||
package com.mojang.minecraft.render;
|
package com.mojang.minecraft.render;
|
||||||
|
|
||||||
|
|
||||||
public class Frustrum {
|
public class Frustrum {
|
||||||
|
|
||||||
public Frustrum() {
|
public float[][] frustrum = new float[16][16];
|
||||||
clippingHelper = ClippingHelperImplementation.getInstance();
|
public float[] projection = new float[16];
|
||||||
}
|
public float[] modelview = new float[16];
|
||||||
|
public float[] clipping = new float[16];
|
||||||
|
|
||||||
public void setPosition(double d, double d1, double d2) {
|
|
||||||
xPosition = d;
|
|
||||||
yPosition = d1;
|
|
||||||
zPosition = d2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBoxInFrustrum(double d, double d1, double d2, double d3, double d4, double d5) {
|
public final boolean isBoxInFrustrum(float var1, float var2, float var3, float var4, float var5, float var6) {
|
||||||
return clippingHelper.isBoxInFrustum(d - xPosition, d1 - yPosition, d2 - zPosition, d3 - xPosition,
|
for(int var7 = 0; var7 < 6; ++var7) {
|
||||||
d4 - yPosition, d5 - zPosition);
|
if(this.frustrum[var7][0] * var1 + this.frustrum[var7][1] * var2 + this.frustrum[var7][2] * var3 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var4 + this.frustrum[var7][1] * var2 + this.frustrum[var7][2] * var3 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var1 + this.frustrum[var7][1] * var5 + this.frustrum[var7][2] * var3 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var4 + this.frustrum[var7][1] * var5 + this.frustrum[var7][2] * var3 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var1 + this.frustrum[var7][1] * var2 + this.frustrum[var7][2] * var6 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var4 + this.frustrum[var7][1] * var2 + this.frustrum[var7][2] * var6 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var1 + this.frustrum[var7][1] * var5 + this.frustrum[var7][2] * var6 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] * var4 + this.frustrum[var7][1] * var5 + this.frustrum[var7][2] * var6 + this.frustrum[var7][3] <= 0.0F) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// public boolean isBoundingBoxInFrustum(AxisAlignedBB axisalignedbb) {
|
return true;
|
||||||
// return isBoxInFrustum(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.maxX,
|
}
|
||||||
// axisalignedbb.maxY, axisalignedbb.maxZ);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public ClippingHelper clippingHelper;
|
|
||||||
private double xPosition;
|
|
||||||
private double yPosition;
|
|
||||||
private double zPosition;
|
|
||||||
}
|
}
|
87
src/teavm/java/com/mojang/minecraft/render/FrustrumImpl.java
Normal file
87
src/teavm/java/com/mojang/minecraft/render/FrustrumImpl.java
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
package com.mojang.minecraft.render;
|
||||||
|
|
||||||
|
import com.mojang.minecraft.render.Frustrum;
|
||||||
|
|
||||||
|
import net.PeytonPlayz585.math.MathHelper;
|
||||||
|
import net.lax1dude.eaglercraft.GLAllocation;
|
||||||
|
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
public final class FrustrumImpl extends Frustrum {
|
||||||
|
|
||||||
|
private static FrustrumImpl instance = new FrustrumImpl();
|
||||||
|
private FloatBuffer projectionBuff = GLAllocation.createDirectFloatBuffer(16);
|
||||||
|
private FloatBuffer modelviewBuff = GLAllocation.createDirectFloatBuffer(16);
|
||||||
|
private FloatBuffer unused = GLAllocation.createDirectFloatBuffer(16);
|
||||||
|
|
||||||
|
|
||||||
|
public static Frustrum update() {
|
||||||
|
FrustrumImpl var0 = instance;
|
||||||
|
instance.projectionBuff.clear();
|
||||||
|
var0.modelviewBuff.clear();
|
||||||
|
var0.unused.clear();
|
||||||
|
GL11.glGetFloat(2983, var0.projectionBuff);
|
||||||
|
GL11.glGetFloat(2982, var0.modelviewBuff);
|
||||||
|
var0.projectionBuff.flip().limit(16);
|
||||||
|
var0.projectionBuff.get(var0.projection);
|
||||||
|
var0.modelviewBuff.flip().limit(16);
|
||||||
|
var0.modelviewBuff.get(var0.modelview);
|
||||||
|
var0.clipping[0] = var0.modelview[0] * var0.projection[0] + var0.modelview[1] * var0.projection[4] + var0.modelview[2] * var0.projection[8] + var0.modelview[3] * var0.projection[12];
|
||||||
|
var0.clipping[1] = var0.modelview[0] * var0.projection[1] + var0.modelview[1] * var0.projection[5] + var0.modelview[2] * var0.projection[9] + var0.modelview[3] * var0.projection[13];
|
||||||
|
var0.clipping[2] = var0.modelview[0] * var0.projection[2] + var0.modelview[1] * var0.projection[6] + var0.modelview[2] * var0.projection[10] + var0.modelview[3] * var0.projection[14];
|
||||||
|
var0.clipping[3] = var0.modelview[0] * var0.projection[3] + var0.modelview[1] * var0.projection[7] + var0.modelview[2] * var0.projection[11] + var0.modelview[3] * var0.projection[15];
|
||||||
|
var0.clipping[4] = var0.modelview[4] * var0.projection[0] + var0.modelview[5] * var0.projection[4] + var0.modelview[6] * var0.projection[8] + var0.modelview[7] * var0.projection[12];
|
||||||
|
var0.clipping[5] = var0.modelview[4] * var0.projection[1] + var0.modelview[5] * var0.projection[5] + var0.modelview[6] * var0.projection[9] + var0.modelview[7] * var0.projection[13];
|
||||||
|
var0.clipping[6] = var0.modelview[4] * var0.projection[2] + var0.modelview[5] * var0.projection[6] + var0.modelview[6] * var0.projection[10] + var0.modelview[7] * var0.projection[14];
|
||||||
|
var0.clipping[7] = var0.modelview[4] * var0.projection[3] + var0.modelview[5] * var0.projection[7] + var0.modelview[6] * var0.projection[11] + var0.modelview[7] * var0.projection[15];
|
||||||
|
var0.clipping[8] = var0.modelview[8] * var0.projection[0] + var0.modelview[9] * var0.projection[4] + var0.modelview[10] * var0.projection[8] + var0.modelview[11] * var0.projection[12];
|
||||||
|
var0.clipping[9] = var0.modelview[8] * var0.projection[1] + var0.modelview[9] * var0.projection[5] + var0.modelview[10] * var0.projection[9] + var0.modelview[11] * var0.projection[13];
|
||||||
|
var0.clipping[10] = var0.modelview[8] * var0.projection[2] + var0.modelview[9] * var0.projection[6] + var0.modelview[10] * var0.projection[10] + var0.modelview[11] * var0.projection[14];
|
||||||
|
var0.clipping[11] = var0.modelview[8] * var0.projection[3] + var0.modelview[9] * var0.projection[7] + var0.modelview[10] * var0.projection[11] + var0.modelview[11] * var0.projection[15];
|
||||||
|
var0.clipping[12] = var0.modelview[12] * var0.projection[0] + var0.modelview[13] * var0.projection[4] + var0.modelview[14] * var0.projection[8] + var0.modelview[15] * var0.projection[12];
|
||||||
|
var0.clipping[13] = var0.modelview[12] * var0.projection[1] + var0.modelview[13] * var0.projection[5] + var0.modelview[14] * var0.projection[9] + var0.modelview[15] * var0.projection[13];
|
||||||
|
var0.clipping[14] = var0.modelview[12] * var0.projection[2] + var0.modelview[13] * var0.projection[6] + var0.modelview[14] * var0.projection[10] + var0.modelview[15] * var0.projection[14];
|
||||||
|
var0.clipping[15] = var0.modelview[12] * var0.projection[3] + var0.modelview[13] * var0.projection[7] + var0.modelview[14] * var0.projection[11] + var0.modelview[15] * var0.projection[15];
|
||||||
|
var0.frustrum[0][0] = var0.clipping[3] - var0.clipping[0];
|
||||||
|
var0.frustrum[0][1] = var0.clipping[7] - var0.clipping[4];
|
||||||
|
var0.frustrum[0][2] = var0.clipping[11] - var0.clipping[8];
|
||||||
|
var0.frustrum[0][3] = var0.clipping[15] - var0.clipping[12];
|
||||||
|
normalize(var0.frustrum, 0);
|
||||||
|
var0.frustrum[1][0] = var0.clipping[3] + var0.clipping[0];
|
||||||
|
var0.frustrum[1][1] = var0.clipping[7] + var0.clipping[4];
|
||||||
|
var0.frustrum[1][2] = var0.clipping[11] + var0.clipping[8];
|
||||||
|
var0.frustrum[1][3] = var0.clipping[15] + var0.clipping[12];
|
||||||
|
normalize(var0.frustrum, 1);
|
||||||
|
var0.frustrum[2][0] = var0.clipping[3] + var0.clipping[1];
|
||||||
|
var0.frustrum[2][1] = var0.clipping[7] + var0.clipping[5];
|
||||||
|
var0.frustrum[2][2] = var0.clipping[11] + var0.clipping[9];
|
||||||
|
var0.frustrum[2][3] = var0.clipping[15] + var0.clipping[13];
|
||||||
|
normalize(var0.frustrum, 2);
|
||||||
|
var0.frustrum[3][0] = var0.clipping[3] - var0.clipping[1];
|
||||||
|
var0.frustrum[3][1] = var0.clipping[7] - var0.clipping[5];
|
||||||
|
var0.frustrum[3][2] = var0.clipping[11] - var0.clipping[9];
|
||||||
|
var0.frustrum[3][3] = var0.clipping[15] - var0.clipping[13];
|
||||||
|
normalize(var0.frustrum, 3);
|
||||||
|
var0.frustrum[4][0] = var0.clipping[3] - var0.clipping[2];
|
||||||
|
var0.frustrum[4][1] = var0.clipping[7] - var0.clipping[6];
|
||||||
|
var0.frustrum[4][2] = var0.clipping[11] - var0.clipping[10];
|
||||||
|
var0.frustrum[4][3] = var0.clipping[15] - var0.clipping[14];
|
||||||
|
normalize(var0.frustrum, 4);
|
||||||
|
var0.frustrum[5][0] = var0.clipping[3] + var0.clipping[2];
|
||||||
|
var0.frustrum[5][1] = var0.clipping[7] + var0.clipping[6];
|
||||||
|
var0.frustrum[5][2] = var0.clipping[11] + var0.clipping[10];
|
||||||
|
var0.frustrum[5][3] = var0.clipping[15] + var0.clipping[14];
|
||||||
|
normalize(var0.frustrum, 5);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void normalize(float[][] var0, int var1) {
|
||||||
|
float var2 = MathHelper.sqrt(var0[var1][0] * var0[var1][0] + var0[var1][1] * var0[var1][1] + var0[var1][2] * var0[var1][2]);
|
||||||
|
var0[var1][0] /= var2;
|
||||||
|
var0[var1][1] /= var2;
|
||||||
|
var0[var1][2] /= var2;
|
||||||
|
var0[var1][3] /= var2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ public final class LevelRenderer {
|
||||||
|
|
||||||
public Level level;
|
public Level level;
|
||||||
public int listId;
|
public int listId;
|
||||||
public IntBuffer buffer = GLAllocation.createDirectIntBuffer(4096);
|
public IntBuffer buffer = GLAllocation.createDirectIntBuffer(65536);
|
||||||
public List<Chunk> chunks = new ArrayList<Chunk>();
|
public List<Chunk> chunks = new ArrayList<Chunk>();
|
||||||
private Chunk[] loadQueue;
|
private Chunk[] loadQueue;
|
||||||
public Chunk[] chunkCache;
|
public Chunk[] chunkCache;
|
||||||
|
@ -26,7 +26,7 @@ public final class LevelRenderer {
|
||||||
private int zChunks;
|
private int zChunks;
|
||||||
private int baseListId;
|
private int baseListId;
|
||||||
public Minecraft minecraft;
|
public Minecraft minecraft;
|
||||||
private int[] chunkDataCache = new int[1024];
|
private int[] chunkDataCache = new int['\uc350'];
|
||||||
public int ticks = 0;
|
public int ticks = 0;
|
||||||
private float lastLoadX = -9999.0F;
|
private float lastLoadX = -9999.0F;
|
||||||
private float lastLoadY = -9999.0F;
|
private float lastLoadY = -9999.0F;
|
||||||
|
@ -37,7 +37,7 @@ public final class LevelRenderer {
|
||||||
public LevelRenderer(Minecraft var1) {
|
public LevelRenderer(Minecraft var1) {
|
||||||
this.minecraft = var1;
|
this.minecraft = var1;
|
||||||
this.listId = GL11.glGenLists(2);
|
this.listId = GL11.glGenLists(2);
|
||||||
this.baseListId = GL11.glGenLists(4096);
|
this.baseListId = GL11.glGenLists(4096 << 6 << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void refresh() {
|
public final void refresh() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user