Bugfixes, end portals now render correctly

This commit is contained in:
LAX1DUDE 2022-10-13 20:11:56 -07:00
parent 9487b93973
commit cd4b6259c3
16 changed files with 538 additions and 287 deletions

View file

@ -106,7 +106,6 @@ uniform vec4 textureGenS_V;
uniform vec4 textureGenT_V;
uniform vec4 textureGenR_V;
uniform vec4 textureGenQ_V;
uniform mat4 matrix_inverse_m;
#endif
#ifdef CC_patch_anisotropic
uniform vec2 anisotropic_fix;
@ -139,33 +138,19 @@ void main(){
#endif
#ifdef CC_TEX_GEN_STRQ
vec4 texSrc[2];
texSrc[0] = v_object_pos;
texSrc[1] = v_position;
vec4 texPos;
if(textureGenS_M == 1){
texPos.x = dot(v_position, textureGenS_V * matrix_inverse_m);
}else{
texPos.x = dot(v_object_pos, textureGenS_V);
}
if(textureGenT_M == 1){
texPos.y = dot(v_position, textureGenT_V * matrix_inverse_m);
}else{
texPos.y = dot(v_object_pos, textureGenT_V);
}
if(textureGenR_M == 1){
texPos.z = dot(v_position, textureGenR_V * matrix_inverse_m);
}else{
texPos.z = dot(v_object_pos, textureGenR_V);
}
if(textureGenQ_M == 1){
texPos.w = dot(v_position, textureGenQ_V * matrix_inverse_m);
}else{
texPos.w = dot(v_object_pos, textureGenQ_V);
}
texPos.x = dot(texSrc[textureGenS_M], textureGenS_V);
texPos.y = dot(texSrc[textureGenT_M], textureGenT_V);
texPos.z = dot(texSrc[textureGenR_M], textureGenR_V);
texPos.w = dot(texSrc[textureGenQ_M], textureGenQ_V);
texPos = matrix_t * texPos;
texPos.x /= texPos.w;
texPos.y /= texPos.w;
texPos.z /= texPos.w;
texPos.w = 1.0;
color *= texture(tex0, texPos.xy).bgra;
color *= texture(tex0, texPos.xy / texPos.w).bgra;
#ifdef CC_alphatest
if(color.a < alphaTestF){
discard;
@ -226,8 +211,8 @@ void main(){
#ifdef CC_fog
float dist = sqrt(dot(v_position, v_position));
float i = (fogMode == 1) ? clamp((dist - fogStart) / (fogEnd - fogStart), 0.0, 1.0) : clamp(1.0 - pow(2.718, -(fogDensity * dist)), 0.0, 1.0);
color.rgb = mix(color.rgb, fogColor.xyz, i * fogColor.a);
float i = fogMode == 1 ? (dist - fogStart) / (fogEnd - fogStart) : 1.0 - pow(2.718, -(fogDensity * dist));
color.rgb = mix(color.rgb, fogColor.xyz, clamp(i, 0.0, 1.0) * fogColor.a);
#endif
fragColor = color;

View file

@ -34,11 +34,11 @@ public class EaglerUUID {
return new EaglerUUID(randomBytes);
}
private static final SHA1Digest yee = new SHA1Digest();
private static final MD5Digest yee = new MD5Digest();
public static EaglerUUID nameUUIDFromBytes(byte[] name) {
yee.update(name, 0, name.length);
byte[] md5Bytes = new byte[20];
byte[] md5Bytes = new byte[16];
yee.doFinal(md5Bytes, 0);
md5Bytes[6] &= 0x0f; /* clear version */
md5Bytes[6] |= 0x30; /* set to version 3 */

View file

@ -0,0 +1,244 @@
package net.lax1dude.eaglercraft.sp;
/**
* implementation of MD5 as outlined in "Handbook of Applied Cryptography",
* pages 346 - 347.
*/
public class MD5Digest extends GeneralDigest {
private static final int DIGEST_LENGTH = 16;
private int H1, H2, H3, H4; // IV's
private int[] X = new int[16];
private int xOff;
public String getAlgorithmName() {
return "MD5";
}
public int getDigestSize() {
return DIGEST_LENGTH;
}
protected void processWord(byte[] in, int inOff) {
X[xOff++] = littleEndianToInt(in, inOff);
if (xOff == 16) {
processBlock();
}
}
private int littleEndianToInt(byte[] bs, int off) {
int n = bs[off] & 0xff;
n |= (bs[++off] & 0xff) << 8;
n |= (bs[++off] & 0xff) << 16;
n |= bs[++off] << 24;
return n;
}
protected void processLength(long bitLength) {
if (xOff > 14) {
processBlock();
}
X[14] = (int) (bitLength & 0xffffffff);
X[15] = (int) (bitLength >>> 32);
}
public int doFinal(byte[] out, int outOff) {
finish();
intToLittleEndian(H1, out, outOff);
intToLittleEndian(H2, out, outOff + 4);
intToLittleEndian(H3, out, outOff + 8);
intToLittleEndian(H4, out, outOff + 12);
reset();
return DIGEST_LENGTH;
}
private void intToLittleEndian(int n, byte[] bs, int off) {
bs[off] = (byte) (n);
bs[++off] = (byte) (n >>> 8);
bs[++off] = (byte) (n >>> 16);
bs[++off] = (byte) (n >>> 24);
}
/**
* reset the chaining variables to the IV values.
*/
public void reset() {
super.reset();
H1 = 0x67452301;
H2 = 0xefcdab89;
H3 = 0x98badcfe;
H4 = 0x10325476;
xOff = 0;
for (int i = 0; i != X.length; i++) {
X[i] = 0;
}
}
//
// round 1 left rotates
//
private static final int S11 = 7;
private static final int S12 = 12;
private static final int S13 = 17;
private static final int S14 = 22;
//
// round 2 left rotates
//
private static final int S21 = 5;
private static final int S22 = 9;
private static final int S23 = 14;
private static final int S24 = 20;
//
// round 3 left rotates
//
private static final int S31 = 4;
private static final int S32 = 11;
private static final int S33 = 16;
private static final int S34 = 23;
//
// round 4 left rotates
//
private static final int S41 = 6;
private static final int S42 = 10;
private static final int S43 = 15;
private static final int S44 = 21;
/*
* rotate int x left n bits.
*/
private int rotateLeft(int x, int n) {
return (x << n) | (x >>> (32 - n));
}
/*
* F, G, H and I are the basic MD5 functions.
*/
private int F(int u, int v, int w) {
return (u & v) | (~u & w);
}
private int G(int u, int v, int w) {
return (u & w) | (v & ~w);
}
private int H(int u, int v, int w) {
return u ^ v ^ w;
}
private int K(int u, int v, int w) {
return v ^ (u | ~w);
}
protected void processBlock() {
int a = H1;
int b = H2;
int c = H3;
int d = H4;
//
// Round 1 - F cycle, 16 times.
//
a = rotateLeft(a + F(b, c, d) + X[0] + 0xd76aa478, S11) + b;
d = rotateLeft(d + F(a, b, c) + X[1] + 0xe8c7b756, S12) + a;
c = rotateLeft(c + F(d, a, b) + X[2] + 0x242070db, S13) + d;
b = rotateLeft(b + F(c, d, a) + X[3] + 0xc1bdceee, S14) + c;
a = rotateLeft(a + F(b, c, d) + X[4] + 0xf57c0faf, S11) + b;
d = rotateLeft(d + F(a, b, c) + X[5] + 0x4787c62a, S12) + a;
c = rotateLeft(c + F(d, a, b) + X[6] + 0xa8304613, S13) + d;
b = rotateLeft(b + F(c, d, a) + X[7] + 0xfd469501, S14) + c;
a = rotateLeft(a + F(b, c, d) + X[8] + 0x698098d8, S11) + b;
d = rotateLeft(d + F(a, b, c) + X[9] + 0x8b44f7af, S12) + a;
c = rotateLeft(c + F(d, a, b) + X[10] + 0xffff5bb1, S13) + d;
b = rotateLeft(b + F(c, d, a) + X[11] + 0x895cd7be, S14) + c;
a = rotateLeft(a + F(b, c, d) + X[12] + 0x6b901122, S11) + b;
d = rotateLeft(d + F(a, b, c) + X[13] + 0xfd987193, S12) + a;
c = rotateLeft(c + F(d, a, b) + X[14] + 0xa679438e, S13) + d;
b = rotateLeft(b + F(c, d, a) + X[15] + 0x49b40821, S14) + c;
//
// Round 2 - G cycle, 16 times.
//
a = rotateLeft(a + G(b, c, d) + X[1] + 0xf61e2562, S21) + b;
d = rotateLeft(d + G(a, b, c) + X[6] + 0xc040b340, S22) + a;
c = rotateLeft(c + G(d, a, b) + X[11] + 0x265e5a51, S23) + d;
b = rotateLeft(b + G(c, d, a) + X[0] + 0xe9b6c7aa, S24) + c;
a = rotateLeft(a + G(b, c, d) + X[5] + 0xd62f105d, S21) + b;
d = rotateLeft(d + G(a, b, c) + X[10] + 0x02441453, S22) + a;
c = rotateLeft(c + G(d, a, b) + X[15] + 0xd8a1e681, S23) + d;
b = rotateLeft(b + G(c, d, a) + X[4] + 0xe7d3fbc8, S24) + c;
a = rotateLeft(a + G(b, c, d) + X[9] + 0x21e1cde6, S21) + b;
d = rotateLeft(d + G(a, b, c) + X[14] + 0xc33707d6, S22) + a;
c = rotateLeft(c + G(d, a, b) + X[3] + 0xf4d50d87, S23) + d;
b = rotateLeft(b + G(c, d, a) + X[8] + 0x455a14ed, S24) + c;
a = rotateLeft(a + G(b, c, d) + X[13] + 0xa9e3e905, S21) + b;
d = rotateLeft(d + G(a, b, c) + X[2] + 0xfcefa3f8, S22) + a;
c = rotateLeft(c + G(d, a, b) + X[7] + 0x676f02d9, S23) + d;
b = rotateLeft(b + G(c, d, a) + X[12] + 0x8d2a4c8a, S24) + c;
//
// Round 3 - H cycle, 16 times.
//
a = rotateLeft(a + H(b, c, d) + X[5] + 0xfffa3942, S31) + b;
d = rotateLeft(d + H(a, b, c) + X[8] + 0x8771f681, S32) + a;
c = rotateLeft(c + H(d, a, b) + X[11] + 0x6d9d6122, S33) + d;
b = rotateLeft(b + H(c, d, a) + X[14] + 0xfde5380c, S34) + c;
a = rotateLeft(a + H(b, c, d) + X[1] + 0xa4beea44, S31) + b;
d = rotateLeft(d + H(a, b, c) + X[4] + 0x4bdecfa9, S32) + a;
c = rotateLeft(c + H(d, a, b) + X[7] + 0xf6bb4b60, S33) + d;
b = rotateLeft(b + H(c, d, a) + X[10] + 0xbebfbc70, S34) + c;
a = rotateLeft(a + H(b, c, d) + X[13] + 0x289b7ec6, S31) + b;
d = rotateLeft(d + H(a, b, c) + X[0] + 0xeaa127fa, S32) + a;
c = rotateLeft(c + H(d, a, b) + X[3] + 0xd4ef3085, S33) + d;
b = rotateLeft(b + H(c, d, a) + X[6] + 0x04881d05, S34) + c;
a = rotateLeft(a + H(b, c, d) + X[9] + 0xd9d4d039, S31) + b;
d = rotateLeft(d + H(a, b, c) + X[12] + 0xe6db99e5, S32) + a;
c = rotateLeft(c + H(d, a, b) + X[15] + 0x1fa27cf8, S33) + d;
b = rotateLeft(b + H(c, d, a) + X[2] + 0xc4ac5665, S34) + c;
//
// Round 4 - K cycle, 16 times.
//
a = rotateLeft(a + K(b, c, d) + X[0] + 0xf4292244, S41) + b;
d = rotateLeft(d + K(a, b, c) + X[7] + 0x432aff97, S42) + a;
c = rotateLeft(c + K(d, a, b) + X[14] + 0xab9423a7, S43) + d;
b = rotateLeft(b + K(c, d, a) + X[5] + 0xfc93a039, S44) + c;
a = rotateLeft(a + K(b, c, d) + X[12] + 0x655b59c3, S41) + b;
d = rotateLeft(d + K(a, b, c) + X[3] + 0x8f0ccc92, S42) + a;
c = rotateLeft(c + K(d, a, b) + X[10] + 0xffeff47d, S43) + d;
b = rotateLeft(b + K(c, d, a) + X[1] + 0x85845dd1, S44) + c;
a = rotateLeft(a + K(b, c, d) + X[8] + 0x6fa87e4f, S41) + b;
d = rotateLeft(d + K(a, b, c) + X[15] + 0xfe2ce6e0, S42) + a;
c = rotateLeft(c + K(d, a, b) + X[6] + 0xa3014314, S43) + d;
b = rotateLeft(b + K(c, d, a) + X[13] + 0x4e0811a1, S44) + c;
a = rotateLeft(a + K(b, c, d) + X[4] + 0xf7537e82, S41) + b;
d = rotateLeft(d + K(a, b, c) + X[11] + 0xbd3af235, S42) + a;
c = rotateLeft(c + K(d, a, b) + X[2] + 0x2ad7d2bb, S43) + d;
b = rotateLeft(b + K(c, d, a) + X[9] + 0xeb86d391, S44) + c;
H1 += a;
H2 += b;
H3 += c;
H4 += d;
//
// reset the offset and clean out the word buffer.
//
xOff = 0;
for (int i = 0; i != X.length; i++) {
X[i] = 0;
}
}
}

View file

@ -1,36 +1,31 @@
package net.lax1dude.eaglercraft.sp;
/**
* implementation of SHA-1 as outlined in "Handbook of Applied Cryptography", pages 346 - 349.
* implementation of SHA-1 as outlined in "Handbook of Applied Cryptography",
* pages 346 - 349.
*
* It is interesting to ponder why the, apart from the extra IV, the other difference here from MD5
* is the "endienness" of the word processing!
* It is interesting to ponder why the, apart from the extra IV, the other
* difference here from MD5 is the "endienness" of the word processing!
*/
public class SHA1Digest
extends GeneralDigest
{
private static final int DIGEST_LENGTH = 20;
public class SHA1Digest extends GeneralDigest {
private static final int DIGEST_LENGTH = 20;
private int H1, H2, H3, H4, H5;
private int H1, H2, H3, H4, H5;
private int[] X = new int[80];
private int xOff;
private int[] X = new int[80];
private int xOff;
/**
* Standard constructor
*/
public SHA1Digest()
{
reset();
}
public SHA1Digest() {
reset();
}
/**
* Copy constructor. This will copy the state of the provided
* message digest.
* Copy constructor. This will copy the state of the provided message digest.
*/
public SHA1Digest(SHA1Digest t)
{
public SHA1Digest(SHA1Digest t) {
super(t);
H1 = t.H1;
@ -43,216 +38,176 @@ public class SHA1Digest
xOff = t.xOff;
}
public String getAlgorithmName()
{
return "SHA-1";
}
public String getAlgorithmName() {
return "SHA-1";
}
public int getDigestSize()
{
return DIGEST_LENGTH;
}
public int getDigestSize() {
return DIGEST_LENGTH;
}
protected void processWord(
byte[] in,
int inOff)
{
X[xOff++] = ((in[inOff] & 0xff) << 24) | ((in[inOff + 1] & 0xff) << 16)
| ((in[inOff + 2] & 0xff) << 8) | ((in[inOff + 3] & 0xff));
protected void processWord(byte[] in, int inOff) {
X[xOff++] = ((in[inOff] & 0xff) << 24) | ((in[inOff + 1] & 0xff) << 16) | ((in[inOff + 2] & 0xff) << 8)
| ((in[inOff + 3] & 0xff));
if (xOff == 16)
{
processBlock();
}
}
if (xOff == 16) {
processBlock();
}
}
private void unpackWord(
int word,
byte[] out,
int outOff)
{
out[outOff] = (byte)(word >>> 24);
out[outOff + 1] = (byte)(word >>> 16);
out[outOff + 2] = (byte)(word >>> 8);
out[outOff + 3] = (byte)word;
}
private void unpackWord(int word, byte[] out, int outOff) {
out[outOff] = (byte) (word >>> 24);
out[outOff + 1] = (byte) (word >>> 16);
out[outOff + 2] = (byte) (word >>> 8);
out[outOff + 3] = (byte) word;
}
protected void processLength(
long bitLength)
{
if (xOff > 14)
{
processBlock();
}
protected void processLength(long bitLength) {
if (xOff > 14) {
processBlock();
}
X[14] = (int)(bitLength >>> 32);
X[15] = (int)(bitLength & 0xffffffff);
}
X[14] = (int) (bitLength >>> 32);
X[15] = (int) (bitLength & 0xffffffff);
}
public int doFinal(
byte[] out,
int outOff)
{
finish();
public int doFinal(byte[] out, int outOff) {
finish();
unpackWord(H1, out, outOff);
unpackWord(H2, out, outOff + 4);
unpackWord(H3, out, outOff + 8);
unpackWord(H4, out, outOff + 12);
unpackWord(H5, out, outOff + 16);
unpackWord(H1, out, outOff);
unpackWord(H2, out, outOff + 4);
unpackWord(H3, out, outOff + 8);
unpackWord(H4, out, outOff + 12);
unpackWord(H5, out, outOff + 16);
reset();
reset();
return DIGEST_LENGTH;
}
return DIGEST_LENGTH;
}
/**
* reset the chaining variables
*/
public void reset()
{
super.reset();
/**
* reset the chaining variables
*/
public void reset() {
super.reset();
H1 = 0x67452301;
H2 = 0xefcdab89;
H3 = 0x98badcfe;
H4 = 0x10325476;
H5 = 0xc3d2e1f0;
H1 = 0x67452301;
H2 = 0xefcdab89;
H3 = 0x98badcfe;
H4 = 0x10325476;
H5 = 0xc3d2e1f0;
xOff = 0;
for (int i = 0; i != X.length; i++)
{
X[i] = 0;
}
}
xOff = 0;
for (int i = 0; i != X.length; i++) {
X[i] = 0;
}
}
//
// Additive constants
//
private static final int Y1 = 0x5a827999;
private static final int Y2 = 0x6ed9eba1;
private static final int Y3 = 0x8f1bbcdc;
private static final int Y4 = 0xca62c1d6;
//
// Additive constants
//
private static final int Y1 = 0x5a827999;
private static final int Y2 = 0x6ed9eba1;
private static final int Y3 = 0x8f1bbcdc;
private static final int Y4 = 0xca62c1d6;
private int f(
int u,
int v,
int w)
{
return ((u & v) | ((~u) & w));
}
private int f(int u, int v, int w) {
return ((u & v) | ((~u) & w));
}
private int h(
int u,
int v,
int w)
{
return (u ^ v ^ w);
}
private int h(int u, int v, int w) {
return (u ^ v ^ w);
}
private int g(
int u,
int v,
int w)
{
return ((u & v) | (u & w) | (v & w));
}
private int g(int u, int v, int w) {
return ((u & v) | (u & w) | (v & w));
}
private int rotateLeft(
int x,
int n)
{
return (x << n) | (x >>> (32 - n));
}
private int rotateLeft(int x, int n) {
return (x << n) | (x >>> (32 - n));
}
protected void processBlock()
{
//
// expand 16 word block into 80 word block.
//
for (int i = 16; i <= 79; i++)
{
X[i] = rotateLeft((X[i - 3] ^ X[i - 8] ^ X[i - 14] ^ X[i - 16]), 1);
}
protected void processBlock() {
//
// expand 16 word block into 80 word block.
//
for (int i = 16; i <= 79; i++) {
X[i] = rotateLeft((X[i - 3] ^ X[i - 8] ^ X[i - 14] ^ X[i - 16]), 1);
}
//
// set up working variables.
//
int A = H1;
int B = H2;
int C = H3;
int D = H4;
int E = H5;
//
// set up working variables.
//
int A = H1;
int B = H2;
int C = H3;
int D = H4;
int E = H5;
//
// round 1
//
for (int j = 0; j <= 19; j++)
{
int t = rotateLeft(A, 5) + f(B, C, D) + E + X[j] + Y1;
//
// round 1
//
for (int j = 0; j <= 19; j++) {
int t = rotateLeft(A, 5) + f(B, C, D) + E + X[j] + Y1;
E = D;
D = C;
C = rotateLeft(B, 30);
B = A;
A = t;
}
E = D;
D = C;
C = rotateLeft(B, 30);
B = A;
A = t;
}
//
// round 2
//
for (int j = 20; j <= 39; j++)
{
int t = rotateLeft(A, 5) + h(B, C, D) + E + X[j] + Y2;
//
// round 2
//
for (int j = 20; j <= 39; j++) {
int t = rotateLeft(A, 5) + h(B, C, D) + E + X[j] + Y2;
E = D;
D = C;
C = rotateLeft(B, 30);
B = A;
A = t;
}
E = D;
D = C;
C = rotateLeft(B, 30);
B = A;
A = t;
}
//
// round 3
//
for (int j = 40; j <= 59; j++)
{
int t = rotateLeft(A, 5) + g(B, C, D) + E + X[j] + Y3;
//
// round 3
//
for (int j = 40; j <= 59; j++) {
int t = rotateLeft(A, 5) + g(B, C, D) + E + X[j] + Y3;
E = D;
D = C;
C = rotateLeft(B, 30);
B = A;
A = t;
}
E = D;
D = C;
C = rotateLeft(B, 30);
B = A;
A = t;
}
//
// round 4
//
for (int j = 60; j <= 79; j++)
{
int t = rotateLeft(A, 5) + h(B, C, D) + E + X[j] + Y4;
//
// round 4
//
for (int j = 60; j <= 79; j++) {
int t = rotateLeft(A, 5) + h(B, C, D) + E + X[j] + Y4;
E = D;
D = C;
C = rotateLeft(B, 30);
B = A;
A = t;
}
E = D;
D = C;
C = rotateLeft(B, 30);
B = A;
A = t;
}
H1 += A;
H2 += B;
H3 += C;
H4 += D;
H5 += E;
H1 += A;
H2 += B;
H3 += C;
H4 += D;
H5 += E;
//
// reset the offset and clean out the word buffer.
//
xOff = 0;
for (int i = 0; i != X.length; i++)
{
X[i] = 0;
}
}
//
// reset the offset and clean out the word buffer.
//
xOff = 0;
for (int i = 0; i != X.length; i++) {
X[i] = 0;
}
}
}

View file

@ -192,7 +192,7 @@ public abstract class Entity {
public int dimension;
protected int teleportDirection;
private boolean invulnerable;
private EaglerUUID entityUniqueID;
protected EaglerUUID entityUniqueID;
public EnumEntitySize myEntitySize;
public Entity(World par1World) {

View file

@ -3,6 +3,7 @@ package net.minecraft.src;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -10,6 +11,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.lax1dude.eaglercraft.sp.EaglerUUID;
import net.minecraft.server.MinecraftServer;
public class EntityPlayerMP extends EntityPlayer implements ICrafting {
@ -104,6 +106,8 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
while (!par2World.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) {
this.setPosition(this.posX, this.posY + 1.0D, this.posZ);
}
this.entityUniqueID = EaglerUUID.nameUUIDFromBytes(("OfflinePlayer:" + par3Str).getBytes(StandardCharsets.UTF_8));
}
/**

View file

@ -6,7 +6,7 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "22w40a";
public static final String version = "22w41a";
public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/lax1dude/eaglercraft";

View file

@ -793,36 +793,44 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static final void glTexGeni(int p1, int p2, int p3) {
}
private static final Vector4f tmpTexGenPlane = new Vector4f();
public static final void glTexGen(int p1, int p2, FloatBuffer p3) {
Vector4f vec = tmpTexGenPlane;
vec.load(p3);
if(p2 == GL_EYE_PLANE) {
tmpMat.load(matModelV[matModelPointer]).invert().transpose();
Matrix4f.transform(tmpMat, vec, vec);
}
switch (p1) {
case GL_S:
texS_plane = (p2 == GL_EYE_PLANE ? 1 : 0);
texS_X = p3.get();
texS_Y = p3.get();
texS_Z = p3.get();
texS_W = p3.get();
texS_X = vec.x;
texS_Y = vec.y;
texS_Z = vec.z;
texS_W = vec.w;
break;
case GL_T:
texT_plane = (p2 == GL_EYE_PLANE ? 1 : 0);
texT_X = p3.get();
texT_Y = p3.get();
texT_Z = p3.get();
texT_W = p3.get();
texT_X = vec.x;
texT_Y = vec.y;
texT_Z = vec.z;
texT_W = vec.w;
break;
case GL_R:
texR_plane = (p2 == GL_EYE_PLANE ? 1 : 0);
texR_X = p3.get();
texR_Y = p3.get();
texR_Z = p3.get();
texR_W = p3.get();
texR_X = vec.x;
texR_Y = vec.y;
texR_Z = vec.z;
texR_W = vec.w;
break;
case GL_Q:
texQ_plane = (p2 == GL_EYE_PLANE ? 1 : 0);
texQ_X = p3.get();
texQ_Y = p3.get();
texQ_Z = p3.get();
texQ_W = p3.get();
texQ_X = vec.x;
texQ_Y = vec.y;
texQ_Z = vec.z;
texQ_W = vec.w;
break;
}
}

View file

@ -136,7 +136,6 @@ public class FixedFunctionShader {
private UniformGL u_textureGenT_V = null;
private UniformGL u_textureGenR_V = null;
private UniformGL u_textureGenQ_V = null;
private UniformGL u_matrix_inverse_m = null;
private UniformGL u_texCoordV0 = null;
private UniformGL u_texCoordV1 = null;
@ -295,7 +294,6 @@ public class FixedFunctionShader {
u_textureGenT_V = _wglGetUniformLocation(globject, "textureGenT_V");
u_textureGenR_V = _wglGetUniformLocation(globject, "textureGenR_V");
u_textureGenQ_V = _wglGetUniformLocation(globject, "textureGenQ_V");
u_matrix_inverse_m = _wglGetUniformLocation(globject, "matrix_inverse_m");
}
if(enable_anisotropic_fix) {
@ -353,7 +351,6 @@ public class FixedFunctionShader {
private Matrix4f modelMatrix = (Matrix4f) new Matrix4f().setZero();
private Matrix4f projectionMatrix = (Matrix4f) new Matrix4f().setZero();
private Matrix4f textureMatrix = (Matrix4f) new Matrix4f().setZero();
private Matrix4f inverseModelMatrix = (Matrix4f) new Matrix4f().setZero();
private Vector4f light0Pos = new Vector4f();
private Vector4f light1Pos = new Vector4f();
private Vector2f anisotropicFix = new Vector2f(0.0f, 0.0f);
@ -370,11 +367,6 @@ public class FixedFunctionShader {
if(!mat.equals(modelMatrix)) {
modelMatrix.load(mat).store(modelBuffer);
_wglUniformMat4fv(u_matrix_m, modelBuffer);
if(enable_TEX_GEN_STRQ) {
inverseModelMatrix.load(mat).invert();
inverseModelMatrix.store(modelBuffer);
_wglUniformMat4fv(u_matrix_inverse_m, modelBuffer);
}
}
}
public void setProjectionMatrix(Matrix4f mat) {

View file

@ -725,7 +725,7 @@ public class EntityRenderer {
if (var2 != null) {
float i = startup / 600.0f;
if(i > 1.0f) i = 1.0f;
i = i * i;
i = i * i * 1.25f;
for (int var3 = 0; var3 < 256; ++var3) {
float var4 = var2.getSunBrightness(1.0F) * 0.95F + 0.05F;
float var5 = var2.provider.lightBrightnessTable[var3 / 16] * var4;

View file

@ -192,12 +192,12 @@ public class FontRenderer {
float var3 = (float) (par1 % 16 * 8);
float var4 = (float) (par1 / 16 * 8);
float var5 = par2 ? 1.0F : 0.0F;
float var6 = (float) this.charWidth[par1] - 0.2F;
float var6 = (float) this.charWidth[par1] - 0.02F;
Tessellator t = Tessellator.instance;
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.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.95F, 0.0F, (var3 + var6) / 128.0F, (var4 + 7.8F) / 128.0F);
t.addVertexWithUV(this.posX + var6 + var5, this.posY + 0.05F, 0.0F, (var3 + var6) / 128.0F, (var4 + 0.1F) / 128.0F);
t.addVertexWithUV(this.posX + 0.01F + var5, this.posY + 0.01F, 0.0F, (var3 + 0.02F) / 128.0F, (var4 + 0.02F) / 128.0F);
t.addVertexWithUV(this.posX + 0.01F - var5, this.posY + 7.99F, 0.0F, (var3 + 0.02F) / 128.0F, (var4 + 7.96F) / 128.0F);
t.addVertexWithUV(this.posX + var6 - var5, this.posY + 7.99F, 0.0F, (var3 + var6) / 128.0F, (var4 + 7.96F) / 128.0F);
t.addVertexWithUV(this.posX + var6 + var5, this.posY + 0.01F, 0.0F, (var3 + var6) / 128.0F, (var4 + 0.02F) / 128.0F);
return (float) this.charWidth[par1];
}
@ -228,13 +228,13 @@ public class FontRenderer {
float var7 = (float) (var5 + 1);
float var8 = (float) (par1 % 16 * 16) + var6;
float var9 = (float) ((par1 & 255) / 16 * 16);
float var10 = var7 - var6 - 0.04F;
float var10 = var7 - var6 - 0.02F;
float var11 = par2 ? 1.0F : 0.0F;
t.startDrawing(EaglerAdapter.GL_TRIANGLE_STRIP);
t.addVertexWithUV(this.posX + 0.02F + var11, this.posY + 0.02F, 0.0F, (var8 + 0.02F) / 256.0F, (var9 + 0.02F) / 256.0F);
t.addVertexWithUV(this.posX + 0.02F - var11, this.posY + 7.98F, 0.0F, (var8 + 0.02F) / 256.0F, (var9 + 15.98F) / 256.0F);
t.addVertexWithUV(this.posX + var10 / 2.0F + var11, this.posY + 0.02F, 0.0F, (var8 + var10) / 256.0F, (var9 + 0.02F) / 256.0F);
t.addVertexWithUV(this.posX + var10 / 2.0F - var11, this.posY + 7.98F, 0.0F, (var8 + var10) / 256.0F, (var9 + 15.98F) / 256.0F);
t.addVertexWithUV(this.posX + 0.01F + var11, this.posY + 0.01F, 0.0F, (var8 + 0.02F) / 256.0F, (var9 + 0.02F) / 256.0F);
t.addVertexWithUV(this.posX + 0.01F - var11, this.posY + 7.99F, 0.0F, (var8 + 0.02F) / 256.0F, (var9 + 15.98F) / 256.0F);
t.addVertexWithUV(this.posX + var10 / 2.0F + var11, this.posY + 0.01F, 0.0F, (var8 + var10) / 256.0F, (var9 + 0.02F) / 256.0F);
t.addVertexWithUV(this.posX + var10 / 2.0F - var11, this.posY + 7.99F, 0.0F, (var8 + var10) / 256.0F, (var9 + 15.98F) / 256.0F);
t.draw();
this.fontTexture.bindTexture();
t.startDrawingQuads();
@ -355,7 +355,7 @@ public class FontRenderer {
var5 = var6;
}
float var11 = this.unicodeFlag ? 0.5F : 1.0F;
float var11 = this.unicodeFlag ? 0.48F : 0.98F;
boolean var7 = (var5 <= 0 || this.unicodeFlag) && par2;
if (var7) {

View file

@ -49,7 +49,7 @@ public class GuiConnecting extends GuiScreen {
uria = uri.substring(6);
}else if(!uri.contains("://")){
uria = uri;
uri = "ws://" + uri;
uri = ( EaglerAdapter.isSSLPage() ? "wss://" : "ws://") + uri;
}else {
this.mc.displayGuiScreen(new GuiDisconnected(this.field_98098_c, "connect.failed", "disconnect.genericReason", "invalid uri websocket protocol", ""));
return;

View file

@ -47,8 +47,6 @@ public class RenderEndPortal extends TileEntitySpecialRenderer {
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_ONE, EaglerAdapter.GL_ONE);
var16 = 0.5F;
}
var16 *= 3.0f;
float var18 = (float) (-(par4 + (double) var13));
float var19 = var18 + ActiveRenderInfo.objectY;
@ -77,7 +75,7 @@ public class RenderEndPortal extends TileEntitySpecialRenderer {
EaglerAdapter.glTranslatef(0.5F, 0.5F, 0.0F);
EaglerAdapter.glRotatef((float) (var14 * var14 * 4321 + var14 * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
EaglerAdapter.glTranslatef(-0.5F, -0.5F, 0.0F);
//EaglerAdapter.glTranslatef(-var9, -var11, -var10);
EaglerAdapter.glTranslatef(-var9, -var11, -var10);
var19 = var18 + ActiveRenderInfo.objectY;
EaglerAdapter.glTranslatef(ActiveRenderInfo.objectX * var15 / var19, ActiveRenderInfo.objectZ * var15 / var19, -var10);
Tessellator var24 = Tessellator.instance;

View file

@ -89,7 +89,9 @@ public class SoundManager {
*/
public void onSoundOptionsChanged() {
EaglerAdapter.setMusicVolume(options.musicVolume);
EaglerAdapter.fireTitleMusicEvent(titleMusic != -1, options.musicVolume);
if(options.musicVolume > 0.0f) {
EaglerAdapter.fireTitleMusicEvent(titleMusic != -1, options.musicVolume);
}
EaglerAdapter.setMasterVolume(options.soundVolume);
}
@ -455,8 +457,10 @@ public class SoundManager {
public void playTheTitleMusic() {
if(titleMusic == -1 || !EaglerAdapter.isPlaying(titleMusic)) {
titleMusic = EaglerAdapter.beginPlaybackStatic("/sounds/gta.mp3", 1.0f, 1.0f, true);
EaglerAdapter.fireTitleMusicEvent(true, this.options.musicVolume);
if(this.options.musicVolume > 0.0f) {
titleMusic = EaglerAdapter.beginPlaybackStatic("/sounds/gta.mp3", 1.0f, 1.0f, true);
EaglerAdapter.fireTitleMusicEvent(true, this.options.musicVolume);
}
}
}

View file

@ -1,5 +1,7 @@
package net.lax1dude.eaglercraft;
import static org.teavm.jso.webgl.WebGLRenderingContext.*;
import java.io.PrintWriter;
import java.io.StringWriter;
@ -8,9 +10,12 @@ import org.json.JSONObject;
import org.teavm.jso.JSBody;
import org.teavm.jso.browser.Window;
import org.teavm.jso.core.JSError;
import org.teavm.jso.dom.html.HTMLCanvasElement;
import org.teavm.jso.dom.html.HTMLDocument;
import org.teavm.jso.dom.html.HTMLElement;
import org.teavm.jso.webgl.WebGLRenderingContext;
import net.lax1dude.eaglercraft.adapter.DetectAnisotropicGlitch;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2;
import net.minecraft.client.Minecraft;
import net.minecraft.src.ServerList;
@ -164,8 +169,8 @@ public class Client {
str.append("eaglercraft.brand = \"eagtek\"\n");
str.append("eaglercraft.username = \"").append(EaglerProfile.username).append("\"\n");
str.append('\n');
//shortenMinecraftOpts();
//addArray(str, "minecraftOpts");
str.append(addWebGLToCrash());
str.append('\n');
str.append(crashScreenOptsDump).append('\n');
str.append('\n');
addDebugNav(str, "userAgent");
@ -213,6 +218,33 @@ public class Client {
}
}
private static String addWebGLToCrash() {
StringBuilder ret = new StringBuilder();
HTMLCanvasElement cvs = (HTMLCanvasElement) Window.current().getDocument().createElement("canvas");
cvs.setWidth(64);
cvs.setHeight(64);
WebGLRenderingContext ctx = EaglerAdapterImpl2.webgl;
if(ctx == null) {
ctx = (WebGLRenderingContext)cvs.getContext("webgl");
}
if(ctx != null) {
if(EaglerAdapterImpl2.webgl != null) {
ret.append("webgl.version = ").append(ctx.getParameterString(VERSION)).append('\n');
}
ret.append("webgl.renderer = ").append(ctx.getParameterString(RENDERER)).append('\n');
ret.append("webgl.vendor = ").append(ctx.getParameterString(VENDOR)).append('\n');
}else {
ret.append("Failed to query GPU info!\n");
}
return ret.toString();
}
public static void showIncompatibleScreen(String t) {
if(!isCrashed) {
isCrashed = true;
@ -231,6 +263,7 @@ public class Client {
+ "<div style=\"margin-left:40px;\">"
+ "<p style=\"font-size:1.2em;\"><b style=\"font-size:1.1em;\">Issue:</b> <span style=\"color:#BB0000;\" id=\"crashReason\"></span><br /></p>"
+ "<p style=\"margin-left:10px;font:0.9em monospace;\" id=\"crashUserAgent\"></p>"
+ "<p style=\"margin-left:10px;font:0.9em monospace;\" id=\"crashWebGL\"></p>"
+ "<p><br /><span style=\"font-size:1.1em;border-bottom:1px dashed #AAAAAA;padding-bottom:5px;\">Things you can try:</span></p>"
+ "<ol>"
+ "<li><span style=\"font-weight:bold;\">Just try using Eaglercraft on a different device</span>, it isn't a bug it's common sense</li>"
@ -248,6 +281,27 @@ public class Client {
EaglerAdapterImpl2.removeEventHandlers();
String webGLRenderer = "No GL_RENDERER string could be queried";
try {
HTMLCanvasElement cvs = (HTMLCanvasElement) Window.current().getDocument().createElement("canvas");
cvs.setWidth(64);
cvs.setHeight(64);
WebGLRenderingContext ctx = (WebGLRenderingContext)cvs.getContext("webgl");
if(ctx != null) {
String r = ctx.getParameterString(RENDERER);
if(r != null) {
webGLRenderer = r;
}
}
}catch(Throwable tt) {
}
div.querySelector("#crashWebGL").appendChild(doc.createTextNode(webGLRenderer));
}
}

View file

@ -1934,22 +1934,29 @@ public class EaglerAdapterImpl2 {
}
}
public static final byte[] loadLocalStorage(String key) {
Storage strg = win.getLocalStorage();
if(strg != null) {
String s = strg.getItem("_eaglercraft."+key);
if(s != null) {
return Base64.decodeBase64(s);
try {
Storage strg = win.getLocalStorage();
if(strg != null) {
String s = strg.getItem("_eaglercraft."+key);
if(s != null) {
return Base64.decodeBase64(s);
}else {
return null;
}
}else {
return null;
}
}else {
}catch(Throwable t) {
return null;
}
}
public static final void saveLocalStorage(String key, byte[] data) {
Storage strg = win.getLocalStorage();
if(strg != null) {
strg.setItem("_eaglercraft."+key, Base64.encodeBase64String(data));
try {
Storage strg = win.getLocalStorage();
if(strg != null) {
strg.setItem("_eaglercraft."+key, Base64.encodeBase64String(data));
}
}catch(Throwable t) {
}
}
public static final void openLink(String url) {