mirror of
https://github.com/Eaglercraft-Archive/Eaglercraftx-1.8.8-src.git
synced 2025-06-27 18:38:14 -05:00
Update #50 - Bug fixes and shader improvements
This commit is contained in:
@ -37,11 +37,11 @@ class OpenGLObjects {
|
||||
|
||||
}
|
||||
|
||||
static class BufferArrayGL implements IBufferArrayGL {
|
||||
static class VertexArrayGL implements IVertexArrayGL {
|
||||
|
||||
final int ptr;
|
||||
|
||||
BufferArrayGL(int ptr) {
|
||||
VertexArrayGL(int ptr) {
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final List<String> dumpActiveExtensions() {
|
||||
public static List<String> dumpActiveExtensions() {
|
||||
List<String> exts = new ArrayList<>();
|
||||
if(hasANGLEInstancedArrays) exts.add("ANGLE_instanced_arrays");
|
||||
if(hasEXTColorBufferFloat) exts.add("EXT_color_buffer_float");
|
||||
@ -133,63 +133,63 @@ public class PlatformOpenGL {
|
||||
return exts;
|
||||
}
|
||||
|
||||
public static final void _wglEnable(int glEnum) {
|
||||
public static void _wglEnable(int glEnum) {
|
||||
glEnable(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglDisable(int glEnum) {
|
||||
public static void _wglDisable(int glEnum) {
|
||||
glDisable(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglClearColor(float r, float g, float b, float a) {
|
||||
public static void _wglClearColor(float r, float g, float b, float a) {
|
||||
glClearColor(r, g, b, a);
|
||||
}
|
||||
|
||||
public static final void _wglClearDepth(float f) {
|
||||
public static void _wglClearDepth(float f) {
|
||||
glClearDepthf(f);
|
||||
}
|
||||
|
||||
public static final void _wglClear(int bits) {
|
||||
public static void _wglClear(int bits) {
|
||||
glClear(bits);
|
||||
}
|
||||
|
||||
public static final void _wglDepthFunc(int glEnum) {
|
||||
public static void _wglDepthFunc(int glEnum) {
|
||||
glDepthFunc(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglDepthMask(boolean mask) {
|
||||
public static void _wglDepthMask(boolean mask) {
|
||||
glDepthMask(mask);
|
||||
}
|
||||
|
||||
public static final void _wglCullFace(int glEnum) {
|
||||
public static void _wglCullFace(int glEnum) {
|
||||
glCullFace(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglViewport(int x, int y, int w, int h) {
|
||||
public static void _wglViewport(int x, int y, int w, int h) {
|
||||
glViewport(x, y, w, h);
|
||||
}
|
||||
|
||||
public static final void _wglBlendFunc(int src, int dst) {
|
||||
public static void _wglBlendFunc(int src, int dst) {
|
||||
glBlendFunc(src, dst);
|
||||
}
|
||||
|
||||
public static final void _wglBlendFuncSeparate(int srcColor, int dstColor, int srcAlpha, int dstAlpha) {
|
||||
public static void _wglBlendFuncSeparate(int srcColor, int dstColor, int srcAlpha, int dstAlpha) {
|
||||
glBlendFuncSeparate(srcColor, dstColor, srcAlpha, dstAlpha);
|
||||
}
|
||||
|
||||
public static final void _wglBlendEquation(int glEnum) {
|
||||
public static void _wglBlendEquation(int glEnum) {
|
||||
glBlendEquation(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglBlendColor(float r, float g, float b, float a) {
|
||||
public static void _wglBlendColor(float r, float g, float b, float a) {
|
||||
glBlendColor(r, g, b, a);
|
||||
}
|
||||
|
||||
public static final void _wglColorMask(boolean r, boolean g, boolean b, boolean a) {
|
||||
public static void _wglColorMask(boolean r, boolean g, boolean b, boolean a) {
|
||||
glColorMask(r, g, b, a);
|
||||
}
|
||||
|
||||
public static final void _wglDrawBuffers(int buffer) {
|
||||
public static void _wglDrawBuffers(int buffer) {
|
||||
if(glesVers == 200) {
|
||||
if(buffer != 0x8CE0) { // GL_COLOR_ATTACHMENT0
|
||||
throw new UnsupportedOperationException();
|
||||
@ -199,7 +199,7 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglDrawBuffers(int[] buffers) {
|
||||
public static void _wglDrawBuffers(int[] buffers) {
|
||||
if(glesVers == 200) {
|
||||
if(buffers.length != 1 || buffers[0] != 0x8CE0) { // GL_COLOR_ATTACHMENT0
|
||||
throw new UnsupportedOperationException();
|
||||
@ -209,83 +209,83 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglReadBuffer(int buffer) {
|
||||
public static void _wglReadBuffer(int buffer) {
|
||||
glReadBuffer(buffer);
|
||||
}
|
||||
|
||||
public static final void _wglReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer data) {
|
||||
public static void _wglReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer data) {
|
||||
nglReadPixels(x, y, width, height, format, type, EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglReadPixels_u16(int x, int y, int width, int height, int format, int type, ByteBuffer data) {
|
||||
public static void _wglReadPixels_u16(int x, int y, int width, int height, int format, int type, ByteBuffer data) {
|
||||
nglReadPixels(x, y, width, height, format, type, EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglReadPixels(int x, int y, int width, int height, int format, int type, IntBuffer data) {
|
||||
public static void _wglReadPixels(int x, int y, int width, int height, int format, int type, IntBuffer data) {
|
||||
nglReadPixels(x, y, width, height, format, type, EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglReadPixels(int x, int y, int width, int height, int format, int type, FloatBuffer data) {
|
||||
public static void _wglReadPixels(int x, int y, int width, int height, int format, int type, FloatBuffer data) {
|
||||
nglReadPixels(x, y, width, height, format, type, EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglPolygonOffset(float f1, float f2) {
|
||||
public static void _wglPolygonOffset(float f1, float f2) {
|
||||
glPolygonOffset(f1, f2);
|
||||
}
|
||||
|
||||
public static final void _wglLineWidth(float width) {
|
||||
public static void _wglLineWidth(float width) {
|
||||
glLineWidth(width);
|
||||
}
|
||||
|
||||
public static final IBufferGL _wglGenBuffers() {
|
||||
public static IBufferGL _wglGenBuffers() {
|
||||
return new OpenGLObjects.BufferGL(glGenBuffers());
|
||||
}
|
||||
|
||||
public static final ITextureGL _wglGenTextures() {
|
||||
public static ITextureGL _wglGenTextures() {
|
||||
return new OpenGLObjects.TextureGL(glGenTextures());
|
||||
}
|
||||
|
||||
public static final IBufferArrayGL _wglGenVertexArrays() {
|
||||
public static IVertexArrayGL _wglGenVertexArrays() {
|
||||
switch(vertexArrayImpl) {
|
||||
case VAO_IMPL_CORE:
|
||||
return new OpenGLObjects.BufferArrayGL(glGenVertexArrays());
|
||||
return new OpenGLObjects.VertexArrayGL(glGenVertexArrays());
|
||||
case VAO_IMPL_OES:
|
||||
return new OpenGLObjects.BufferArrayGL(glGenVertexArraysOES());
|
||||
return new OpenGLObjects.VertexArrayGL(glGenVertexArraysOES());
|
||||
default:
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
public static final IProgramGL _wglCreateProgram() {
|
||||
public static IProgramGL _wglCreateProgram() {
|
||||
return new OpenGLObjects.ProgramGL(glCreateProgram());
|
||||
}
|
||||
|
||||
public static final IShaderGL _wglCreateShader(int type) {
|
||||
public static IShaderGL _wglCreateShader(int type) {
|
||||
return new OpenGLObjects.ShaderGL(glCreateShader(type));
|
||||
}
|
||||
|
||||
public static final IFramebufferGL _wglCreateFramebuffer() {
|
||||
public static IFramebufferGL _wglCreateFramebuffer() {
|
||||
return new OpenGLObjects.FramebufferGL(glGenFramebuffers());
|
||||
}
|
||||
|
||||
public static final IRenderbufferGL _wglCreateRenderbuffer() {
|
||||
public static IRenderbufferGL _wglCreateRenderbuffer() {
|
||||
return new OpenGLObjects.RenderbufferGL(glGenRenderbuffers());
|
||||
}
|
||||
|
||||
public static final IQueryGL _wglGenQueries() {
|
||||
public static IQueryGL _wglGenQueries() {
|
||||
return new OpenGLObjects.QueryGL(glGenQueries());
|
||||
}
|
||||
|
||||
public static final void _wglDeleteBuffers(IBufferGL obj) {
|
||||
public static void _wglDeleteBuffers(IBufferGL obj) {
|
||||
glDeleteBuffers(((OpenGLObjects.BufferGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteTextures(ITextureGL obj) {
|
||||
public static void _wglDeleteTextures(ITextureGL obj) {
|
||||
glDeleteTextures(((OpenGLObjects.TextureGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteVertexArrays(IBufferArrayGL obj) {
|
||||
int ptr = ((OpenGLObjects.BufferArrayGL) obj).ptr;
|
||||
public static void _wglDeleteVertexArrays(IVertexArrayGL obj) {
|
||||
int ptr = ((OpenGLObjects.VertexArrayGL) obj).ptr;
|
||||
switch(vertexArrayImpl) {
|
||||
case VAO_IMPL_CORE:
|
||||
glDeleteVertexArrays(ptr);
|
||||
@ -298,66 +298,66 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglDeleteProgram(IProgramGL obj) {
|
||||
public static void _wglDeleteProgram(IProgramGL obj) {
|
||||
glDeleteProgram(((OpenGLObjects.ProgramGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteShader(IShaderGL obj) {
|
||||
public static void _wglDeleteShader(IShaderGL obj) {
|
||||
glDeleteShader(((OpenGLObjects.ShaderGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteFramebuffer(IFramebufferGL obj) {
|
||||
public static void _wglDeleteFramebuffer(IFramebufferGL obj) {
|
||||
glDeleteFramebuffers(((OpenGLObjects.FramebufferGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteRenderbuffer(IRenderbufferGL obj) {
|
||||
public static void _wglDeleteRenderbuffer(IRenderbufferGL obj) {
|
||||
glDeleteRenderbuffers(((OpenGLObjects.RenderbufferGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteQueries(IQueryGL obj) {
|
||||
public static void _wglDeleteQueries(IQueryGL obj) {
|
||||
glDeleteQueries(((OpenGLObjects.QueryGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglBindBuffer(int target, IBufferGL obj) {
|
||||
public static void _wglBindBuffer(int target, IBufferGL obj) {
|
||||
glBindBuffer(target, obj == null ? 0 : ((OpenGLObjects.BufferGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglBufferData(int target, ByteBuffer data, int usage) {
|
||||
public static void _wglBufferData(int target, ByteBuffer data, int usage) {
|
||||
nglBufferData(target, data == null ? 0 : data.remaining(),
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data), usage);
|
||||
}
|
||||
|
||||
public static final void _wglBufferData(int target, IntBuffer data, int usage) {
|
||||
public static void _wglBufferData(int target, IntBuffer data, int usage) {
|
||||
nglBufferData(target, data == null ? 0 : (data.remaining() << 2),
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data), usage);
|
||||
}
|
||||
|
||||
public static final void _wglBufferData(int target, FloatBuffer data, int usage) {
|
||||
public static void _wglBufferData(int target, FloatBuffer data, int usage) {
|
||||
nglBufferData(target, data == null ? 0 : (data.remaining() << 2),
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data), usage);
|
||||
}
|
||||
|
||||
public static final void _wglBufferData(int target, int size, int usage) {
|
||||
public static void _wglBufferData(int target, int size, int usage) {
|
||||
glBufferData(target, size, usage);
|
||||
}
|
||||
|
||||
public static final void _wglBufferSubData(int target, int offset, ByteBuffer data) {
|
||||
public static void _wglBufferSubData(int target, int offset, ByteBuffer data) {
|
||||
nglBufferSubData(target, offset, data == null ? 0 : data.remaining(),
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglBufferSubData(int target, int offset, IntBuffer data) {
|
||||
public static void _wglBufferSubData(int target, int offset, IntBuffer data) {
|
||||
nglBufferSubData(target, offset, data == null ? 0 : (data.remaining() << 2),
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglBufferSubData(int target, int offset, FloatBuffer data) {
|
||||
public static void _wglBufferSubData(int target, int offset, FloatBuffer data) {
|
||||
nglBufferSubData(target, offset, data == null ? 0 : (data.remaining() << 2),
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglBindVertexArray(IBufferArrayGL obj) {
|
||||
int ptr = obj == null ? 0 : ((OpenGLObjects.BufferArrayGL) obj).ptr;
|
||||
public static void _wglBindVertexArray(IVertexArrayGL obj) {
|
||||
int ptr = obj == null ? 0 : ((OpenGLObjects.VertexArrayGL) obj).ptr;
|
||||
switch(vertexArrayImpl) {
|
||||
case VAO_IMPL_CORE:
|
||||
glBindVertexArray(ptr);
|
||||
@ -370,20 +370,20 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglEnableVertexAttribArray(int index) {
|
||||
public static void _wglEnableVertexAttribArray(int index) {
|
||||
glEnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public static final void _wglDisableVertexAttribArray(int index) {
|
||||
public static void _wglDisableVertexAttribArray(int index) {
|
||||
glDisableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public static final void _wglVertexAttribPointer(int index, int size, int type, boolean normalized, int stride,
|
||||
public static void _wglVertexAttribPointer(int index, int size, int type, boolean normalized, int stride,
|
||||
int offset) {
|
||||
glVertexAttribPointer(index, size, type, normalized, stride, offset);
|
||||
}
|
||||
|
||||
public static final void _wglVertexAttribDivisor(int index, int divisor) {
|
||||
public static void _wglVertexAttribDivisor(int index, int divisor) {
|
||||
switch(instancingImpl) {
|
||||
case INSTANCE_IMPL_CORE:
|
||||
glVertexAttribDivisor(index, divisor);
|
||||
@ -399,88 +399,88 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglActiveTexture(int texture) {
|
||||
public static void _wglActiveTexture(int texture) {
|
||||
glActiveTexture(texture);
|
||||
}
|
||||
|
||||
public static final void _wglBindTexture(int target, ITextureGL obj) {
|
||||
public static void _wglBindTexture(int target, ITextureGL obj) {
|
||||
glBindTexture(target, obj == null ? 0 : ((OpenGLObjects.TextureGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglTexParameterf(int target, int param, float value) {
|
||||
public static void _wglTexParameterf(int target, int param, float value) {
|
||||
glTexParameterf(target, param, value);
|
||||
}
|
||||
|
||||
public static final void _wglTexParameteri(int target, int param, int value) {
|
||||
public static void _wglTexParameteri(int target, int param, int value) {
|
||||
glTexParameteri(target, param, value);
|
||||
}
|
||||
|
||||
public static final void _wglTexImage3D(int target, int level, int internalFormat, int width, int height, int depth,
|
||||
public static void _wglTexImage3D(int target, int level, int internalFormat, int width, int height, int depth,
|
||||
int border, int format, int type, ByteBuffer data) {
|
||||
nglTexImage3D(target, level, internalFormat, width, height, depth, border, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2D(int target, int level, int internalFormat, int width, int height,
|
||||
public static void _wglTexImage2D(int target, int level, int internalFormat, int width, int height,
|
||||
int border, int format, int type, ByteBuffer data) {
|
||||
nglTexImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2D(int target, int level, int internalFormat, int width, int height,
|
||||
public static void _wglTexImage2D(int target, int level, int internalFormat, int width, int height,
|
||||
int border, int format, int type, IntBuffer data) {
|
||||
nglTexImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2Df32(int target, int level, int internalFormat, int width, int height,
|
||||
public static void _wglTexImage2Df32(int target, int level, int internalFormat, int width, int height,
|
||||
int border, int format, int type, FloatBuffer data) {
|
||||
nglTexImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2Du16(int target, int level, int internalFormat, int width, int height,
|
||||
public static void _wglTexImage2Du16(int target, int level, int internalFormat, int width, int height,
|
||||
int border, int format, int type, ByteBuffer data) {
|
||||
nglTexImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2Df32(int target, int level, int internalFormat, int width, int height,
|
||||
public static void _wglTexImage2Df32(int target, int level, int internalFormat, int width, int height,
|
||||
int border, int format, int type, ByteBuffer data) {
|
||||
nglTexImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height,
|
||||
public static void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height,
|
||||
int format, int type, ByteBuffer data) {
|
||||
nglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height,
|
||||
public static void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height,
|
||||
int format, int type, IntBuffer data) {
|
||||
nglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexSubImage2Df32(int target, int level, int xoffset, int yoffset, int width, int height,
|
||||
public static void _wglTexSubImage2Df32(int target, int level, int xoffset, int yoffset, int width, int height,
|
||||
int format, int type, FloatBuffer data) {
|
||||
nglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexSubImage2Du16(int target, int level, int xoffset, int yoffset, int width, int height,
|
||||
public static void _wglTexSubImage2Du16(int target, int level, int xoffset, int yoffset, int width, int height,
|
||||
int format, int type, ByteBuffer data) {
|
||||
nglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||
data == null ? 0l : EaglerLWJGLAllocator.getAddress(data));
|
||||
}
|
||||
|
||||
public static final void _wglCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
public static void _wglCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
int width, int height) {
|
||||
glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
public static final void _wglTexStorage2D(int target, int levels, int internalFormat, int w, int h) {
|
||||
public static void _wglTexStorage2D(int target, int levels, int internalFormat, int w, int h) {
|
||||
switch(texStorageImpl) {
|
||||
case TEX_STORAGE_IMPL_CORE:
|
||||
glTexStorage2D(target, levels, internalFormat, w, h);
|
||||
@ -493,67 +493,67 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglPixelStorei(int pname, int value) {
|
||||
public static void _wglPixelStorei(int pname, int value) {
|
||||
glPixelStorei(pname, value);
|
||||
}
|
||||
|
||||
public static final void _wglGenerateMipmap(int target) {
|
||||
public static void _wglGenerateMipmap(int target) {
|
||||
glGenerateMipmap(target);
|
||||
}
|
||||
|
||||
public static final void _wglShaderSource(IShaderGL obj, String source) {
|
||||
public static void _wglShaderSource(IShaderGL obj, String source) {
|
||||
glShaderSource(((OpenGLObjects.ShaderGL) obj).ptr, source);
|
||||
}
|
||||
|
||||
public static final void _wglCompileShader(IShaderGL obj) {
|
||||
public static void _wglCompileShader(IShaderGL obj) {
|
||||
glCompileShader(((OpenGLObjects.ShaderGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final int _wglGetShaderi(IShaderGL obj, int param) {
|
||||
public static int _wglGetShaderi(IShaderGL obj, int param) {
|
||||
return glGetShaderi(((OpenGLObjects.ShaderGL) obj).ptr, param);
|
||||
}
|
||||
|
||||
public static final String _wglGetShaderInfoLog(IShaderGL obj) {
|
||||
public static String _wglGetShaderInfoLog(IShaderGL obj) {
|
||||
return glGetShaderInfoLog(((OpenGLObjects.ShaderGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglUseProgram(IProgramGL obj) {
|
||||
public static void _wglUseProgram(IProgramGL obj) {
|
||||
glUseProgram(obj == null ? 0 : ((OpenGLObjects.ProgramGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglAttachShader(IProgramGL obj, IShaderGL shader) {
|
||||
public static void _wglAttachShader(IProgramGL obj, IShaderGL shader) {
|
||||
glAttachShader(((OpenGLObjects.ProgramGL) obj).ptr, ((OpenGLObjects.ShaderGL) shader).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDetachShader(IProgramGL obj, IShaderGL shader) {
|
||||
public static void _wglDetachShader(IProgramGL obj, IShaderGL shader) {
|
||||
glDetachShader(((OpenGLObjects.ProgramGL) obj).ptr, ((OpenGLObjects.ShaderGL) shader).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglLinkProgram(IProgramGL obj) {
|
||||
public static void _wglLinkProgram(IProgramGL obj) {
|
||||
glLinkProgram(((OpenGLObjects.ProgramGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final int _wglGetProgrami(IProgramGL obj, int param) {
|
||||
public static int _wglGetProgrami(IProgramGL obj, int param) {
|
||||
return glGetProgrami(((OpenGLObjects.ProgramGL) obj).ptr, param);
|
||||
}
|
||||
|
||||
public static final String _wglGetProgramInfoLog(IProgramGL obj) {
|
||||
public static String _wglGetProgramInfoLog(IProgramGL obj) {
|
||||
return glGetProgramInfoLog(((OpenGLObjects.ProgramGL) obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglBindAttribLocation(IProgramGL obj, int index, String name) {
|
||||
public static void _wglBindAttribLocation(IProgramGL obj, int index, String name) {
|
||||
glBindAttribLocation(((OpenGLObjects.ProgramGL) obj).ptr, index, name);
|
||||
}
|
||||
|
||||
public static final int _wglGetAttribLocation(IProgramGL obj, String name) {
|
||||
public static int _wglGetAttribLocation(IProgramGL obj, String name) {
|
||||
return glGetAttribLocation(((OpenGLObjects.ProgramGL) obj).ptr, name);
|
||||
}
|
||||
|
||||
public static final void _wglDrawArrays(int mode, int first, int count) {
|
||||
public static void _wglDrawArrays(int mode, int first, int count) {
|
||||
glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
public static final void _wglDrawArraysInstanced(int mode, int first, int count, int instanced) {
|
||||
public static void _wglDrawArraysInstanced(int mode, int first, int count, int instanced) {
|
||||
switch(instancingImpl) {
|
||||
case INSTANCE_IMPL_CORE:
|
||||
glDrawArraysInstanced(mode, first, count, instanced);
|
||||
@ -569,11 +569,11 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglDrawElements(int mode, int count, int type, int offset) {
|
||||
public static void _wglDrawElements(int mode, int count, int type, int offset) {
|
||||
glDrawElements(mode, count, type, offset);
|
||||
}
|
||||
|
||||
public static final void _wglDrawElementsInstanced(int mode, int count, int type, int offset, int instanced) {
|
||||
public static void _wglDrawElementsInstanced(int mode, int count, int type, int offset, int instanced) {
|
||||
switch(instancingImpl) {
|
||||
case INSTANCE_IMPL_CORE:
|
||||
glDrawElementsInstanced(mode, count, type, offset, instanced);
|
||||
@ -589,49 +589,49 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final IUniformGL _wglGetUniformLocation(IProgramGL obj, String name) {
|
||||
public static IUniformGL _wglGetUniformLocation(IProgramGL obj, String name) {
|
||||
int loc = glGetUniformLocation(((OpenGLObjects.ProgramGL) obj).ptr, name);
|
||||
return loc < 0 ? null : new OpenGLObjects.UniformGL(loc);
|
||||
}
|
||||
|
||||
public static final int _wglGetUniformBlockIndex(IProgramGL obj, String name) {
|
||||
public static int _wglGetUniformBlockIndex(IProgramGL obj, String name) {
|
||||
return glGetUniformBlockIndex(((OpenGLObjects.ProgramGL) obj).ptr, name);
|
||||
}
|
||||
|
||||
public static final void _wglBindBufferRange(int target, int index, IBufferGL buffer, int offset, int size) {
|
||||
public static void _wglBindBufferRange(int target, int index, IBufferGL buffer, int offset, int size) {
|
||||
glBindBufferRange(target, index, ((OpenGLObjects.BufferGL) buffer).ptr, offset, size);
|
||||
}
|
||||
|
||||
public static final void _wglUniformBlockBinding(IProgramGL obj, int blockIndex, int bufferIndex) {
|
||||
public static void _wglUniformBlockBinding(IProgramGL obj, int blockIndex, int bufferIndex) {
|
||||
glUniformBlockBinding(((OpenGLObjects.ProgramGL) obj).ptr, blockIndex, bufferIndex);
|
||||
}
|
||||
|
||||
public static final void _wglUniform1f(IUniformGL obj, float x) {
|
||||
public static void _wglUniform1f(IUniformGL obj, float x) {
|
||||
if (obj != null)
|
||||
glUniform1f(((OpenGLObjects.UniformGL) obj).ptr, x);
|
||||
}
|
||||
|
||||
public static final void _wglUniform2f(IUniformGL obj, float x, float y) {
|
||||
public static void _wglUniform2f(IUniformGL obj, float x, float y) {
|
||||
if (obj != null)
|
||||
glUniform2f(((OpenGLObjects.UniformGL) obj).ptr, x, y);
|
||||
}
|
||||
|
||||
public static final void _wglUniform3f(IUniformGL obj, float x, float y, float z) {
|
||||
public static void _wglUniform3f(IUniformGL obj, float x, float y, float z) {
|
||||
if (obj != null)
|
||||
glUniform3f(((OpenGLObjects.UniformGL) obj).ptr, x, y, z);
|
||||
}
|
||||
|
||||
public static final void _wglUniform4f(IUniformGL obj, float x, float y, float z, float w) {
|
||||
public static void _wglUniform4f(IUniformGL obj, float x, float y, float z, float w) {
|
||||
if (obj != null)
|
||||
glUniform4f(((OpenGLObjects.UniformGL) obj).ptr, x, y, z, w);
|
||||
}
|
||||
|
||||
public static final void _wglUniform1i(IUniformGL obj, int x) {
|
||||
public static void _wglUniform1i(IUniformGL obj, int x) {
|
||||
if (obj != null)
|
||||
glUniform1i(((OpenGLObjects.UniformGL) obj).ptr, x);
|
||||
}
|
||||
|
||||
public static final void _wglUniform2i(IUniformGL obj, int x, int y) {
|
||||
public static void _wglUniform2i(IUniformGL obj, int x, int y) {
|
||||
if (obj != null)
|
||||
glUniform2i(((OpenGLObjects.UniformGL) obj).ptr, x, y);
|
||||
}
|
||||
@ -641,48 +641,48 @@ public class PlatformOpenGL {
|
||||
glUniform3i(((OpenGLObjects.UniformGL) obj).ptr, x, y, z);
|
||||
}
|
||||
|
||||
public static final void _wglUniform4i(IUniformGL obj, int x, int y, int z, int w) {
|
||||
public static void _wglUniform4i(IUniformGL obj, int x, int y, int z, int w) {
|
||||
if (obj != null)
|
||||
glUniform4i(((OpenGLObjects.UniformGL) obj).ptr, x, y, z, w);
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if (obj != null)
|
||||
nglUniformMatrix2fv(((OpenGLObjects.UniformGL) obj).ptr, mat.remaining() >> 2, transpose,
|
||||
EaglerLWJGLAllocator.getAddress(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix3fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix3fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if (obj != null)
|
||||
nglUniformMatrix3fv(((OpenGLObjects.UniformGL) obj).ptr, mat.remaining() / 9, transpose,
|
||||
EaglerLWJGLAllocator.getAddress(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix3x2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix3x2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if (obj != null)
|
||||
nglUniformMatrix3x2fv(((OpenGLObjects.UniformGL) obj).ptr, mat.remaining() / 6, transpose,
|
||||
EaglerLWJGLAllocator.getAddress(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix4fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix4fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if (obj != null)
|
||||
nglUniformMatrix4fv(((OpenGLObjects.UniformGL) obj).ptr, mat.remaining() >> 4, transpose,
|
||||
EaglerLWJGLAllocator.getAddress(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix4x2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix4x2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if (obj != null)
|
||||
nglUniformMatrix4x2fv(((OpenGLObjects.UniformGL) obj).ptr, mat.remaining() >> 3, transpose,
|
||||
EaglerLWJGLAllocator.getAddress(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix4x3fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix4x3fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if (obj != null)
|
||||
nglUniformMatrix4x3fv(((OpenGLObjects.UniformGL) obj).ptr, mat.remaining() / 12, transpose,
|
||||
EaglerLWJGLAllocator.getAddress(mat));
|
||||
}
|
||||
|
||||
public static final void _wglBindFramebuffer(int target, IFramebufferGL framebuffer) {
|
||||
public static void _wglBindFramebuffer(int target, IFramebufferGL framebuffer) {
|
||||
if(framebuffer == null) {
|
||||
glBindFramebuffer(target, 0);
|
||||
}else {
|
||||
@ -690,87 +690,87 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final int _wglCheckFramebufferStatus(int target) {
|
||||
public static int _wglCheckFramebufferStatus(int target) {
|
||||
return glCheckFramebufferStatus(target);
|
||||
}
|
||||
|
||||
public static final void _wglFramebufferTexture2D(int target, int attachment, int texTarget, ITextureGL texture,
|
||||
public static void _wglFramebufferTexture2D(int target, int attachment, int texTarget, ITextureGL texture,
|
||||
int level) {
|
||||
glFramebufferTexture2D(target, attachment, texTarget, ((OpenGLObjects.TextureGL) texture).ptr, level);
|
||||
}
|
||||
|
||||
public static final void _wglFramebufferTextureLayer(int target, int attachment, ITextureGL texture, int level, int layer) {
|
||||
public static void _wglFramebufferTextureLayer(int target, int attachment, ITextureGL texture, int level, int layer) {
|
||||
glFramebufferTextureLayer(target, attachment, ((OpenGLObjects.TextureGL) texture).ptr, level, layer);
|
||||
}
|
||||
|
||||
public static final void _wglBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0,
|
||||
public static void _wglBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0,
|
||||
int dstX1, int dstY1, int bits, int filter) {
|
||||
glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, bits, filter);
|
||||
}
|
||||
|
||||
public static final void _wglBindRenderbuffer(int target, IRenderbufferGL renderbuffer) {
|
||||
public static void _wglBindRenderbuffer(int target, IRenderbufferGL renderbuffer) {
|
||||
glBindRenderbuffer(target, renderbuffer == null ? 0 : ((OpenGLObjects.RenderbufferGL) renderbuffer).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglRenderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
public static void _wglRenderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
glRenderbufferStorage(target, internalformat, width, height);
|
||||
}
|
||||
|
||||
public static final void _wglFramebufferRenderbuffer(int target, int attachment, int renderbufferTarget,
|
||||
public static void _wglFramebufferRenderbuffer(int target, int attachment, int renderbufferTarget,
|
||||
IRenderbufferGL renderbuffer) {
|
||||
glFramebufferRenderbuffer(target, attachment, renderbufferTarget,
|
||||
((OpenGLObjects.RenderbufferGL) renderbuffer).ptr);
|
||||
}
|
||||
|
||||
public static final String _wglGetString(int param) {
|
||||
public static String _wglGetString(int param) {
|
||||
return glGetString(param);
|
||||
}
|
||||
|
||||
public static final int _wglGetInteger(int param) {
|
||||
public static int _wglGetInteger(int param) {
|
||||
return glGetInteger(param);
|
||||
}
|
||||
|
||||
public static final int _wglGetError() {
|
||||
public static int _wglGetError() {
|
||||
return glGetError();
|
||||
}
|
||||
|
||||
public static final int checkOpenGLESVersion() {
|
||||
public static int checkOpenGLESVersion() {
|
||||
return glesVers;
|
||||
}
|
||||
|
||||
public static final boolean checkEXTGPUShader5Capable() {
|
||||
public static boolean checkEXTGPUShader5Capable() {
|
||||
return hasEXTGPUShader5;
|
||||
}
|
||||
|
||||
public static final boolean checkOESGPUShader5Capable() {
|
||||
public static boolean checkOESGPUShader5Capable() {
|
||||
return hasOESGPUShader5;
|
||||
}
|
||||
|
||||
public static final boolean checkFBORenderMipmapCapable() {
|
||||
public static boolean checkFBORenderMipmapCapable() {
|
||||
return hasOESFBORenderMipmap;
|
||||
}
|
||||
|
||||
public static final boolean checkVAOCapable() {
|
||||
public static boolean checkVAOCapable() {
|
||||
return vertexArrayImpl != VAO_IMPL_NONE;
|
||||
}
|
||||
|
||||
public static final boolean checkInstancingCapable() {
|
||||
public static boolean checkInstancingCapable() {
|
||||
return instancingImpl != INSTANCE_IMPL_NONE;
|
||||
}
|
||||
|
||||
public static final boolean checkTexStorageCapable() {
|
||||
public static boolean checkTexStorageCapable() {
|
||||
return texStorageImpl != TEX_STORAGE_IMPL_NONE;
|
||||
}
|
||||
|
||||
public static final boolean checkTextureLODCapable() {
|
||||
public static boolean checkTextureLODCapable() {
|
||||
return glesVers >= 300 || hasEXTShaderTextureLOD;
|
||||
}
|
||||
|
||||
public static final boolean checkNPOTCapable() {
|
||||
public static boolean checkNPOTCapable() {
|
||||
return glesVers >= 300;
|
||||
}
|
||||
|
||||
public static final boolean checkHDRFramebufferSupport(int bits) {
|
||||
public static boolean checkHDRFramebufferSupport(int bits) {
|
||||
switch(bits) {
|
||||
case 16:
|
||||
return hasFBO16FSupport;
|
||||
@ -781,7 +781,7 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final boolean checkLinearHDRFilteringSupport(int bits) {
|
||||
public static boolean checkLinearHDRFilteringSupport(int bits) {
|
||||
switch(bits) {
|
||||
case 16:
|
||||
return hasLinearHDR16FSupport;
|
||||
@ -793,19 +793,19 @@ public class PlatformOpenGL {
|
||||
}
|
||||
|
||||
// legacy
|
||||
public static final boolean checkLinearHDR32FSupport() {
|
||||
public static boolean checkLinearHDR32FSupport() {
|
||||
return hasLinearHDR32FSupport;
|
||||
}
|
||||
|
||||
public static final boolean checkAnisotropicFilteringSupport() {
|
||||
public static boolean checkAnisotropicFilteringSupport() {
|
||||
return hasEXTTextureFilterAnisotropic;
|
||||
}
|
||||
|
||||
public static final String[] getAllExtensions() {
|
||||
public static String[] getAllExtensions() {
|
||||
return glGetString(GL_EXTENSIONS).split(" ");
|
||||
}
|
||||
|
||||
public static final void enterVAOEmulationHook() {
|
||||
public static void enterVAOEmulationHook() {
|
||||
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,6 @@ public final class SunNormalizer {
|
||||
* {@link java.text.Normalizer.Form#NFKC},
|
||||
* {@link java.text.Normalizer.Form#NFKD}
|
||||
* @param option The normalization option;
|
||||
* {@link sun.text.Normalizer#UNICODE_3_2}
|
||||
* @return The normalized String
|
||||
* @throws NullPointerException If <code>src</code> or <code>form</code> is
|
||||
* null.
|
||||
@ -75,7 +74,6 @@ public final class SunNormalizer {
|
||||
* {@link java.text.Normalizer.Form#NFKC},
|
||||
* {@link java.text.Normalizer.Form#NFKD}
|
||||
* @param option The normalization option;
|
||||
* {@link sun.text.Normalizer#UNICODE_3_2}
|
||||
* @return true if the sequence of char values is normalized; false otherwise.
|
||||
* @throws NullPointerException If <code>src</code> or <code>form</code> is
|
||||
* null.
|
||||
|
@ -42,6 +42,7 @@ import java.util.Arrays;
|
||||
|
||||
import jdk_internal.icu.util.VersionInfo;
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.HString;
|
||||
|
||||
public final class ICUBinary {
|
||||
|
||||
@ -227,7 +228,7 @@ public final class ICUBinary {
|
||||
|| bytes.get(14) != (byte) (dataFormat >> 8) || bytes.get(15) != (byte) dataFormat
|
||||
|| (authenticate != null && !authenticate.isDataVersionAcceptable(formatVersion))) {
|
||||
throw new IOException(HEADER_AUTHENTICATION_FAILED_
|
||||
+ String.format("; data format %02x%02x%02x%02x, format version %d.%d.%d.%d", bytes.get(12),
|
||||
+ HString.format("; data format %02x%02x%02x%02x, format version %d.%d.%d.%d", bytes.get(12),
|
||||
bytes.get(13), bytes.get(14), bytes.get(15), formatVersion[0] & 0xff,
|
||||
formatVersion[1] & 0xff, formatVersion[2] & 0xff, formatVersion[3] & 0xff));
|
||||
}
|
||||
|
@ -53,16 +53,20 @@ public class ClientUUIDLoadingCache {
|
||||
if(ret == null) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc != null && mc.thePlayer != null && mc.thePlayer.sendQueue.getEaglerMessageProtocol().ver >= 4) {
|
||||
ret = PENDING_UUID;
|
||||
EaglercraftUUID playerUUID = player.getUniqueID();
|
||||
if(!waitingUUIDs.containsKey(playerUUID) && !evictedUUIDs.containsKey(playerUUID)) {
|
||||
int reqID = ++requestId & 0x3FFF;
|
||||
WaitingLookup newLookup = new WaitingLookup(reqID, playerUUID, EagRuntime.steadyTimeMillis(),
|
||||
(AbstractClientPlayer) player);
|
||||
waitingIDs.put(reqID, newLookup);
|
||||
waitingUUIDs.put(playerUUID, newLookup);
|
||||
mc.thePlayer.sendQueue.sendEaglerMessage(
|
||||
new CPacketGetOtherClientUUIDV4EAG(reqID, newLookup.uuid.msb, newLookup.uuid.lsb));
|
||||
if(ignoreNonEaglerPlayers && !player.getGameProfile().getTextures().eaglerPlayer) {
|
||||
ret = VANILLA_UUID;
|
||||
}else {
|
||||
ret = PENDING_UUID;
|
||||
EaglercraftUUID playerUUID = player.getUniqueID();
|
||||
if(!waitingUUIDs.containsKey(playerUUID) && !evictedUUIDs.containsKey(playerUUID)) {
|
||||
int reqID = ++requestId & 0x3FFF;
|
||||
WaitingLookup newLookup = new WaitingLookup(reqID, playerUUID, EagRuntime.steadyTimeMillis(),
|
||||
(AbstractClientPlayer) player);
|
||||
waitingIDs.put(reqID, newLookup);
|
||||
waitingUUIDs.put(playerUUID, newLookup);
|
||||
mc.thePlayer.sendQueue.sendEaglerMessage(
|
||||
new CPacketGetOtherClientUUIDV4EAG(reqID, newLookup.uuid.msb, newLookup.uuid.lsb));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,6 +86,7 @@ public class ClientUUIDLoadingCache {
|
||||
private static int requestId = 0;
|
||||
private static long lastFlushReq = EagRuntime.steadyTimeMillis();
|
||||
private static long lastFlushEvict = EagRuntime.steadyTimeMillis();
|
||||
private static boolean ignoreNonEaglerPlayers = false;
|
||||
|
||||
public static void update() {
|
||||
long timestamp = EagRuntime.steadyTimeMillis();
|
||||
@ -117,13 +122,19 @@ public class ClientUUIDLoadingCache {
|
||||
evictedUUIDs.clear();
|
||||
}
|
||||
|
||||
private static final EaglercraftUUID MAGIC_DISABLE_NON_EAGLER_PLAYERS = new EaglercraftUUID(0xEEEEA64771094C4EL, 0x86E55B81D17E67EBL);
|
||||
|
||||
public static void handleResponse(int requestId, EaglercraftUUID clientId) {
|
||||
WaitingLookup lookup = waitingIDs.remove(requestId);
|
||||
if(lookup != null) {
|
||||
lookup.player.clientBrandUUIDCache = clientId;
|
||||
waitingUUIDs.remove(lookup.uuid);
|
||||
}else {
|
||||
logger.warn("Unsolicited client brand UUID lookup response #{} recieved! (Brand UUID: {})", requestId, clientId);
|
||||
if(requestId == -1 && MAGIC_DISABLE_NON_EAGLER_PLAYERS.equals(clientId)) {
|
||||
ignoreNonEaglerPlayers = true;
|
||||
}else {
|
||||
logger.warn("Unsolicited client brand UUID lookup response #{} recieved! (Brand UUID: {})", requestId, clientId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,6 +146,10 @@ public class ClientUUIDLoadingCache {
|
||||
}
|
||||
}
|
||||
|
||||
public static void resetFlags() {
|
||||
ignoreNonEaglerPlayers = false;
|
||||
}
|
||||
|
||||
private static class WaitingLookup {
|
||||
|
||||
private final int reqID;
|
||||
|
@ -10,7 +10,7 @@ public class EaglercraftVersion {
|
||||
/// Customize these to fit your fork:
|
||||
|
||||
public static final String projectForkName = "EaglercraftX";
|
||||
public static final String projectForkVersion = "u49";
|
||||
public static final String projectForkVersion = "u50";
|
||||
public static final String projectForkVendor = "lax1dude";
|
||||
|
||||
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
|
||||
@ -20,20 +20,20 @@ public class EaglercraftVersion {
|
||||
public static final String projectOriginName = "EaglercraftX";
|
||||
public static final String projectOriginAuthor = "lax1dude";
|
||||
public static final String projectOriginRevision = "1.8";
|
||||
public static final String projectOriginVersion = "u49";
|
||||
public static final String projectOriginVersion = "u50";
|
||||
|
||||
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
||||
|
||||
// EPK Version Identifier
|
||||
|
||||
public static final String EPKVersionIdentifier = "u49"; // Set to null to disable EPK version check
|
||||
public static final String EPKVersionIdentifier = "u50"; // Set to null to disable EPK version check
|
||||
|
||||
// Updating configuration
|
||||
|
||||
public static final boolean enableUpdateService = true;
|
||||
|
||||
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
||||
public static final int updateBundlePackageVersionInt = 49;
|
||||
public static final int updateBundlePackageVersionInt = 50;
|
||||
|
||||
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
||||
|
||||
|
@ -27,6 +27,8 @@ public abstract class AbstractWebSocketClient implements IWebSocketClient {
|
||||
protected volatile int availableBinaryFrames = 0;
|
||||
protected final List<IWebSocketFrame> recievedPacketBuffer = new LinkedList<>();
|
||||
protected String currentURI;
|
||||
private boolean strEnable = true;
|
||||
private boolean binEnable = true;
|
||||
|
||||
protected AbstractWebSocketClient(String currentURI) {
|
||||
this.currentURI = currentURI;
|
||||
@ -34,6 +36,13 @@ public abstract class AbstractWebSocketClient implements IWebSocketClient {
|
||||
|
||||
protected void addRecievedFrame(IWebSocketFrame frame) {
|
||||
boolean str = frame.isString();
|
||||
if(str) {
|
||||
if(!strEnable)
|
||||
return;
|
||||
}else {
|
||||
if(!binEnable)
|
||||
return;
|
||||
}
|
||||
synchronized(recievedPacketBuffer) {
|
||||
recievedPacketBuffer.add(frame);
|
||||
if(str) {
|
||||
@ -225,4 +234,14 @@ public abstract class AbstractWebSocketClient implements IWebSocketClient {
|
||||
return currentURI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnableStringFrames(boolean enable) {
|
||||
strEnable = enable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnableBinaryFrames(boolean enable) {
|
||||
binEnable = enable;
|
||||
}
|
||||
|
||||
}
|
@ -16,6 +16,6 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.internal;
|
||||
|
||||
public interface IBufferArrayGL extends IObjectGL {
|
||||
public interface IVertexArrayGL extends IObjectGL {
|
||||
|
||||
}
|
@ -60,4 +60,8 @@ public interface IWebSocketClient {
|
||||
|
||||
String getCurrentURI();
|
||||
|
||||
void setEnableStringFrames(boolean enable);
|
||||
|
||||
void setEnableBinaryFrames(boolean enable);
|
||||
|
||||
}
|
@ -1,14 +1,11 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.minecraft;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.WorldVertexBufferUploader;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -198,9 +195,7 @@ public class ChunkUpdateManager {
|
||||
}
|
||||
|
||||
private void uploadDisplayList(WorldRenderer chunkRenderer, int parInt1, RenderChunk parRenderChunk) {
|
||||
EaglercraftGPU.glNewList(parInt1, GL_COMPILE);
|
||||
WorldVertexBufferUploader.func_181679_a(chunkRenderer);
|
||||
EaglercraftGPU.glEndList();
|
||||
WorldVertexBufferUploader.uploadDisplayList(parInt1, chunkRenderer);
|
||||
}
|
||||
|
||||
public boolean isAlreadyQueued(RenderChunk update) {
|
||||
|
@ -112,7 +112,7 @@ public class EaglerCloudRenderer {
|
||||
}
|
||||
|
||||
if(newState != RENDER_STATE_FAST) {
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.enableCull();
|
||||
double d0 = this.mc.renderGlobal.getCloudCounter(partialTicks);
|
||||
double d1 = (rve.prevPosX + (rve.posX - rve.prevPosX) * (double) partialTicks + d0 * 0.029999999329447746D) / 12.0D;
|
||||
double d2 = (rve.prevPosZ + (rve.posZ - rve.prevPosZ) * (double) partialTicks) / 12.0D + 0.33000001311302185D;
|
||||
@ -193,7 +193,7 @@ public class EaglerCloudRenderer {
|
||||
yy = 1;
|
||||
}
|
||||
|
||||
EaglercraftGPU.glCallList(renderListFancy[(yy + 1) * 3 + xx + 1]);
|
||||
GlStateManager.callList(renderListFancy[(yy + 1) * 3 + xx + 1]);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
@ -220,15 +220,15 @@ public class EaglerCloudRenderer {
|
||||
GlStateManager.matrixMode(GL_TEXTURE);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(f8, f9, 0.0f);
|
||||
EaglercraftGPU.glCallList(renderList);
|
||||
GlStateManager.callList(renderList);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(GL_MODELVIEW);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableCull();
|
||||
}
|
||||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableCull();
|
||||
}
|
||||
|
||||
private void rebuild(int newState) {
|
||||
@ -243,11 +243,9 @@ public class EaglerCloudRenderer {
|
||||
if(renderListFancy[i] == -1) {
|
||||
renderListFancy[i] = EaglercraftGPU.glGenLists();
|
||||
}
|
||||
EaglercraftGPU.glNewList(renderListFancy[i], GL_COMPILE);
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
generateFancyClouds(worldrenderer, i, newState != RENDER_STATE_FANCY_BELOW, newState != RENDER_STATE_FANCY_ABOVE);
|
||||
tessellator.draw();
|
||||
EaglercraftGPU.glEndList();
|
||||
tessellator.uploadDisplayList(renderListFancy[i]);
|
||||
}
|
||||
}else {
|
||||
if(renderList == -1) {
|
||||
@ -259,24 +257,32 @@ public class EaglerCloudRenderer {
|
||||
renderListFancy[i] = -1;
|
||||
}
|
||||
}
|
||||
EaglercraftGPU.glNewList(renderList, GL_COMPILE);
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
final double d = 4.8828125E-4;
|
||||
worldrenderer.pos(-256.0f, 0.0f, 256.0f).tex(-256.0f * d, 256.0f * d).endVertex();
|
||||
worldrenderer.pos(256.0f, 0.0f, 256.0f).tex(256.0f * d, 256.0f * d).endVertex();
|
||||
worldrenderer.pos(256.0f, 0.0f, -256.0f).tex(256.0f * d, -256.0f * d).endVertex();
|
||||
worldrenderer.pos(-256.0f, 0.0f, -256.0f).tex(-256.0f * d, -256.0f * d).endVertex();
|
||||
tessellator.draw();
|
||||
EaglercraftGPU.glEndList();
|
||||
tessellator.uploadDisplayList(renderList);
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateFancyClouds(WorldRenderer worldrenderer, int mesh, boolean renderAbove, boolean renderBelow) {
|
||||
int xx = (mesh % 3) - 1;
|
||||
int yy = (mesh / 3) - 1;
|
||||
boolean center = xx == 0 && yy == 0 && renderAbove && renderBelow;
|
||||
|
||||
if (renderAbove) {
|
||||
worldrenderer.pos(0.0f, 0.0f, 8.0f).tex(0.0f, 8.0f * 0.00390625F).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, 8.0f).tex(8.0f * 0.00390625f, 8.0f * 0.00390625f).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, 0.0f).tex(8.0f * 0.00390625f, 0.0f).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
worldrenderer.pos(0.0f, 0.0f, 0.0f).tex(0.0f, 0.0f).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, 0.0f).tex(8.0f * 0.00390625f, 0.0f).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, 8.0f).tex(8.0f * 0.00390625f, 8.0f * 0.00390625f).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
if(center) {
|
||||
worldrenderer.pos(0.0f, 0.0f, 8.0f).tex(0.0f, 8.0f * 0.00390625F).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, 8.0f).tex(8.0f * 0.00390625f, 8.0f * 0.00390625f).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, 0.0f).tex(8.0f * 0.00390625f, 0.0f).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
worldrenderer.pos(0.0f, 0.0f, 0.0f).tex(0.0f, 0.0f).color(0.7f, 0.7f, 0.7f, 1.0f).endVertex();
|
||||
}
|
||||
}
|
||||
|
||||
if (renderBelow) {
|
||||
@ -284,11 +290,14 @@ public class EaglerCloudRenderer {
|
||||
worldrenderer.pos(8.0f, 4.0f - 9.765625E-4f, 8.0f).tex(8.0f * 0.00390625F, 8.0f * 0.00390625f).color(1.0f, 1.0f, 1.0f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 4.0f - 9.765625E-4f, 0.0f).tex(8.0f * 0.00390625f, 0.0f).color(1.0f, 1.0f, 1.0f, 1.0f).endVertex();
|
||||
worldrenderer.pos(0.0f, 4.0f - 9.765625E-4f, 0.0f).tex(0.0f, 0.0f).color(1.0f, 1.0f, 1.0f, 1.0f).endVertex();
|
||||
if(center) {
|
||||
worldrenderer.pos(0.0f, 4.0f - 9.765625E-4f, 8.0f).tex(0.0f, 8.0f * 0.00390625f).color(1.0f, 1.0f, 1.0f, 1.0f).endVertex();
|
||||
worldrenderer.pos(0.0f, 4.0f - 9.765625E-4f, 0.0f).tex(0.0f, 0.0f).color(1.0f, 1.0f, 1.0f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 4.0f - 9.765625E-4f, 0.0f).tex(8.0f * 0.00390625f, 0.0f).color(1.0f, 1.0f, 1.0f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 4.0f - 9.765625E-4f, 8.0f).tex(8.0f * 0.00390625F, 8.0f * 0.00390625f).color(1.0f, 1.0f, 1.0f, 1.0f).endVertex();
|
||||
}
|
||||
}
|
||||
|
||||
int xx = (mesh % 3) - 1;
|
||||
int yy = (mesh / 3) - 1;
|
||||
|
||||
if (xx != -1) {
|
||||
for (int j1 = 0; j1 < 8; ++j1) {
|
||||
worldrenderer.pos(j1, 0.0f, 8.0f).tex((j1 + 0.5f) * 0.00390625f, 8.0f * 0.00390625f)
|
||||
@ -299,6 +308,16 @@ public class EaglerCloudRenderer {
|
||||
.endVertex();
|
||||
worldrenderer.pos(j1, 0.0f, 0.0f).tex((j1 + 0.5f) * 0.00390625f, 0.0f).color(0.9f, 0.9f, 0.9f, 1.0f)
|
||||
.endVertex();
|
||||
if(center) {
|
||||
worldrenderer.pos(j1, 0.0f, 8.0f).tex((j1 + 0.5f) * 0.00390625f, 8.0f * 0.00390625f)
|
||||
.color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
worldrenderer.pos(j1, 0.0f, 0.0f).tex((j1 + 0.5f) * 0.00390625f, 0.0f).color(0.9f, 0.9f, 0.9f, 1.0f)
|
||||
.endVertex();
|
||||
worldrenderer.pos(j1, 4.0f, 0.0f).tex((j1 + 0.5f) * 0.00390625f, 0.0f).color(0.9f, 0.9f, 0.9f, 1.0f)
|
||||
.endVertex();
|
||||
worldrenderer.pos(j1, 4.0f, 8.0f).tex((j1 + 0.5f) * 0.00390625f, 8.0f * 0.00390625f)
|
||||
.color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,12 +325,22 @@ public class EaglerCloudRenderer {
|
||||
for (int k1 = 0; k1 < 8; ++k1) {
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 0.0f, 8.0f)
|
||||
.tex((k1 + 0.5f) * 0.00390625f, 8.0f * 0.00390625f).color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 4.0f, 8.0f)
|
||||
.tex((k1 + 0.5f) * 0.00390625f, 8.0f * 0.00390625f).color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 4.0f, 0.0f).tex((k1 + 0.5f) * 0.00390625f, 0.0f)
|
||||
.color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 0.0f, 0.0f).tex((k1 + 0.5f) * 0.00390625f, 0.0f)
|
||||
.color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 4.0f, 0.0f).tex((k1 + 0.5f) * 0.00390625f, 0.0f)
|
||||
.color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 4.0f, 8.0f)
|
||||
.tex((k1 + 0.5f) * 0.00390625f, 8.0f * 0.00390625f).color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
if(center) {
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 0.0f, 8.0f)
|
||||
.tex((k1 + 0.5f) * 0.00390625f, 8.0f * 0.00390625f).color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 4.0f, 8.0f)
|
||||
.tex((k1 + 0.5f) * 0.00390625f, 8.0f * 0.00390625f).color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 4.0f, 0.0f).tex((k1 + 0.5f) * 0.00390625f, 0.0f)
|
||||
.color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
worldrenderer.pos(k1 + 1.0f - 9.765625E-4f, 0.0f, 0.0f).tex((k1 + 0.5f) * 0.00390625f, 0.0f)
|
||||
.color(0.9f, 0.9f, 0.9f, 1.0f).endVertex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,6 +354,16 @@ public class EaglerCloudRenderer {
|
||||
.color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(0.0f, 0.0f, l1).tex(0.0f, (l1 + 0.5f) * 0.00390625f).color(0.8f, 0.8f, 0.8f, 1.0f)
|
||||
.endVertex();
|
||||
if(center) {
|
||||
worldrenderer.pos(0.0f, 4.0f, l1).tex(0.0f, (l1 + 0.5f) * 0.00390625f).color(0.8f, 0.8f, 0.8f, 1.0f)
|
||||
.endVertex();
|
||||
worldrenderer.pos(0.0f, 0.0f, l1).tex(0.0f, (l1 + 0.5f) * 0.00390625f).color(0.8f, 0.8f, 0.8f, 1.0f)
|
||||
.endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, l1).tex(8.0f * 0.00390625f, (l1 + 0.5f) * 0.00390625f)
|
||||
.color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 4.0f, l1).tex(8.0f * 0.00390625f, (l1 + 0.5f) * 0.00390625f)
|
||||
.color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,12 +371,22 @@ public class EaglerCloudRenderer {
|
||||
for (int i2 = 0; i2 < 8; ++i2) {
|
||||
worldrenderer.pos(0.0f, 4.0f, i2 + 1.0f - 9.765625E-4f).tex(0.0f, (i2 + 0.5f) * 0.00390625f)
|
||||
.color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 4.0f, i2 + 1.0f - 9.765625E-4f)
|
||||
.tex(8.0f * 0.00390625f, (i2 + 0.5f) * 0.00390625f).color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, i2 + 1.0f - 9.765625E-4f)
|
||||
.tex(8.0f * 0.00390625f, (i2 + 0.5f) * 0.00390625f).color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(0.0f, 0.0f, i2 + 1.0f - 9.765625E-4f).tex(0.0f, (i2 + 0.5f) * 0.00390625f)
|
||||
.color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, i2 + 1.0f - 9.765625E-4f)
|
||||
.tex(8.0f * 0.00390625f, (i2 + 0.5f) * 0.00390625f).color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 4.0f, i2 + 1.0f - 9.765625E-4f)
|
||||
.tex(8.0f * 0.00390625f, (i2 + 0.5f) * 0.00390625f).color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
if(center) {
|
||||
worldrenderer.pos(0.0f, 4.0f, i2 + 1.0f - 9.765625E-4f).tex(0.0f, (i2 + 0.5f) * 0.00390625f)
|
||||
.color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 4.0f, i2 + 1.0f - 9.765625E-4f)
|
||||
.tex(8.0f * 0.00390625f, (i2 + 0.5f) * 0.00390625f).color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(8.0f, 0.0f, i2 + 1.0f - 9.765625E-4f)
|
||||
.tex(8.0f * 0.00390625f, (i2 + 0.5f) * 0.00390625f).color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
worldrenderer.pos(0.0f, 0.0f, i2 + 1.0f - 9.765625E-4f).tex(0.0f, (i2 + 0.5f) * 0.00390625f)
|
||||
.color(0.8f, 0.8f, 0.8f, 1.0f).endVertex();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2025 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.minecraft;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IFramebufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.AbstractTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
public class MainMenuSkyboxTexture extends AbstractTexture {
|
||||
|
||||
public static final int _GL_FRAMEBUFFER = 0x8D40;
|
||||
public static final int _GL_COLOR_ATTACHMENT0 = 0x8CE0;
|
||||
|
||||
private IFramebufferGL framebuffer = null;
|
||||
|
||||
public MainMenuSkyboxTexture(int width, int height) {
|
||||
TextureUtil.allocateTexture(this.getGlTextureId(), width, height);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTexture(IResourceManager var1) throws IOException {
|
||||
}
|
||||
|
||||
public void bindFramebuffer() {
|
||||
if(framebuffer == null) {
|
||||
framebuffer = _wglCreateFramebuffer();
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, framebuffer);
|
||||
int tex = getGlTextureId();
|
||||
GlStateManager.bindTexture(tex);
|
||||
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||
EaglercraftGPU.getNativeTexture(tex), 0);
|
||||
}else {
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, framebuffer);
|
||||
}
|
||||
_wglDrawBuffers(new int[] { _GL_COLOR_ATTACHMENT0 });
|
||||
}
|
||||
|
||||
public void deleteGlTexture() {
|
||||
super.deleteGlTexture();
|
||||
if(framebuffer != null) {
|
||||
_wglDeleteFramebuffer(framebuffer);
|
||||
framebuffer = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -19,9 +19,6 @@ package net.lax1dude.eaglercraft.v1_8.notifications;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Collections2;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||
import net.lax1dude.eaglercraft.v1_8.socket.protocol.pkt.server.SPacketNotifBadgeShowV4EAG.EnumBadgePriority;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -88,12 +85,8 @@ public class GuiScreenNotifications extends GuiScreen {
|
||||
selectedUUID = lst.get(oldSelectedId).badge.badgeUUID;
|
||||
}
|
||||
lst.clear();
|
||||
lst.addAll(Collections2.transform(Collections2.filter(mgr.getNotifLongHistory(), new Predicate<NotificationBadge>() {
|
||||
@Override
|
||||
public boolean apply(NotificationBadge input) {
|
||||
return input.priority.priority >= priorityOrder[showPriority];
|
||||
}
|
||||
}), GuiSlotNotifications.NotifBadgeSlot::new));
|
||||
mgr.getNotifLongHistory().stream().filter((input) -> input.priority.priority >= priorityOrder[showPriority])
|
||||
.map(GuiSlotNotifications.NotifBadgeSlot::new).forEach(lst::add);
|
||||
selected = -1;
|
||||
if(selectedUUID != null) {
|
||||
for(int i = 0, l = lst.size(); i < l; ++i) {
|
||||
|
@ -16,12 +16,12 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.opengl;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
|
||||
class DisplayList {
|
||||
|
||||
IBufferArrayGL vertexArray = null;
|
||||
IVertexArrayGL vertexArray = null;
|
||||
IBufferGL vertexBuffer = null;
|
||||
int attribs = -1;
|
||||
int mode = -1;
|
||||
|
@ -22,7 +22,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
|
||||
@ -32,8 +32,8 @@ public class DrawUtils {
|
||||
public static final String vertexShaderPath = "/assets/eagler/glsl/local.vsh";
|
||||
public static final String vertexShaderPrecision = "precision highp float;\n";
|
||||
|
||||
public static IBufferArrayGL standardQuad2DVAO = null;
|
||||
public static IBufferArrayGL standardQuad3DVAO = null;
|
||||
public static IVertexArrayGL standardQuad2DVAO = null;
|
||||
public static IVertexArrayGL standardQuad3DVAO = null;
|
||||
public static IBufferGL standardQuadVBO = null;
|
||||
|
||||
public static IShaderGL vshLocal = null;
|
||||
@ -41,8 +41,8 @@ public class DrawUtils {
|
||||
|
||||
static void init() {
|
||||
if(standardQuad2DVAO == null) {
|
||||
standardQuad2DVAO = EaglercraftGPU.createGLBufferArray();
|
||||
standardQuad3DVAO = EaglercraftGPU.createGLBufferArray();
|
||||
standardQuad2DVAO = EaglercraftGPU.createGLVertexArray();
|
||||
standardQuad3DVAO = EaglercraftGPU.createGLVertexArray();
|
||||
standardQuadVBO = _wglGenBuffers();
|
||||
|
||||
FloatBuffer verts = EagRuntime.allocateFloatBuffer(18);
|
||||
@ -56,12 +56,12 @@ public class DrawUtils {
|
||||
_wglBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
|
||||
EagRuntime.freeFloatBuffer(verts);
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(standardQuad2DVAO);
|
||||
EaglercraftGPU.bindGLVertexArray(standardQuad2DVAO);
|
||||
|
||||
EaglercraftGPU.enableVertexAttribArray(0);
|
||||
EaglercraftGPU.vertexAttribPointer(0, 2, GL_FLOAT, false, 12, 0);
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(standardQuad3DVAO);
|
||||
EaglercraftGPU.bindGLVertexArray(standardQuad3DVAO);
|
||||
|
||||
EaglercraftGPU.enableVertexAttribArray(0);
|
||||
EaglercraftGPU.vertexAttribPointer(0, 3, GL_FLOAT, false, 12, 0);
|
||||
@ -92,22 +92,22 @@ public class DrawUtils {
|
||||
}
|
||||
|
||||
public static void drawStandardQuad2D() {
|
||||
EaglercraftGPU.bindGLBufferArray(standardQuad2DVAO);
|
||||
EaglercraftGPU.doDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
EaglercraftGPU.bindGLVertexArray(standardQuad2DVAO);
|
||||
EaglercraftGPU.drawArrays(GL_TRIANGLES, 0, 6);
|
||||
}
|
||||
|
||||
public static void drawStandardQuad3D() {
|
||||
EaglercraftGPU.bindGLBufferArray(standardQuad3DVAO);
|
||||
EaglercraftGPU.doDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
EaglercraftGPU.bindGLVertexArray(standardQuad3DVAO);
|
||||
EaglercraftGPU.drawArrays(GL_TRIANGLES, 0, 6);
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
if(standardQuad2DVAO != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(standardQuad2DVAO);
|
||||
EaglercraftGPU.destroyGLVertexArray(standardQuad2DVAO);
|
||||
standardQuad2DVAO = null;
|
||||
}
|
||||
if(standardQuad3DVAO != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(standardQuad3DVAO);
|
||||
EaglercraftGPU.destroyGLVertexArray(standardQuad3DVAO);
|
||||
standardQuad3DVAO = null;
|
||||
}
|
||||
if(standardQuadVBO != null) {
|
||||
|
@ -106,13 +106,13 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
|
||||
}
|
||||
|
||||
if(meshStruct.vertexArray == null) {
|
||||
meshStruct.vertexArray = EaglercraftGPU.createGLBufferArray();
|
||||
meshStruct.vertexArray = EaglercraftGPU.createGLVertexArray();
|
||||
}
|
||||
if(meshStruct.vertexBuffer == null) {
|
||||
meshStruct.vertexBuffer = _wglGenBuffers();
|
||||
meshStruct.vertexBuffer = EaglercraftGPU.createGLArrayBuffer();
|
||||
}
|
||||
if(meshStruct.indexBuffer == null) {
|
||||
meshStruct.indexBuffer = _wglGenBuffers();
|
||||
meshStruct.indexBuffer = EaglercraftGPU.createGLElementArrayBuffer();
|
||||
}
|
||||
|
||||
up1.position(0).limit(intsOfVertex);
|
||||
@ -120,7 +120,7 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
|
||||
EaglercraftGPU.bindVAOGLArrayBufferNow(meshStruct.vertexBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, up1, GL_STATIC_DRAW);
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(meshStruct.vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(meshStruct.vertexArray);
|
||||
|
||||
up1.position(intsOfVertex).limit(intsTotal);
|
||||
|
||||
@ -139,15 +139,15 @@ public class EaglerMeshLoader implements IResourceManagerReloadListener {
|
||||
EaglercraftGPU.vertexAttribPointer(meshStruct.hasTexture ? 2 : 1, 4, GL_BYTE, true, stride, 12);
|
||||
}catch(Throwable ex) {
|
||||
if(meshStruct.vertexArray != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(meshStruct.vertexArray);
|
||||
EaglercraftGPU.destroyGLVertexArray(meshStruct.vertexArray);
|
||||
meshStruct.vertexArray = null;
|
||||
}
|
||||
if(meshStruct.vertexBuffer != null) {
|
||||
_wglDeleteBuffers(meshStruct.vertexBuffer);
|
||||
EaglercraftGPU.destroyGLArrayBuffer(meshStruct.vertexBuffer);
|
||||
meshStruct.vertexBuffer = null;
|
||||
}
|
||||
if(meshStruct.indexBuffer != null) {
|
||||
_wglDeleteBuffers(meshStruct.indexBuffer);
|
||||
EaglercraftGPU.destroyGLElementArrayBuffer(meshStruct.indexBuffer);
|
||||
meshStruct.indexBuffer = null;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
|
||||
* Copyright (c) 2022-2025 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
@ -28,7 +28,7 @@ import com.carrotsearch.hppc.IntObjectMap;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.GLObjectMap;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IQueryGL;
|
||||
@ -40,6 +40,48 @@ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
|
||||
public class EaglercraftGPU {
|
||||
|
||||
static final GLObjectRecycler<IBufferGL> arrayBufferRecycler = new GLObjectRecycler<IBufferGL>(32) {
|
||||
|
||||
@Override
|
||||
protected IBufferGL create() {
|
||||
return _wglGenBuffers();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void destroy(IBufferGL object) {
|
||||
_wglDeleteBuffers(object);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static final GLObjectRecycler<IBufferGL> elementArrayBufferRecycler = new GLObjectRecycler<IBufferGL>(32) {
|
||||
|
||||
@Override
|
||||
protected IBufferGL create() {
|
||||
return _wglGenBuffers();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void destroy(IBufferGL object) {
|
||||
_wglDeleteBuffers(object);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static final GLObjectRecycler<IVertexArrayGL> VAORecycler = new GLObjectRecycler<IVertexArrayGL>(128) {
|
||||
|
||||
@Override
|
||||
protected IVertexArrayGL create() {
|
||||
return _wglGenVertexArrays();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void destroy(IVertexArrayGL object) {
|
||||
_wglDeleteVertexArrays(object);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static final GLObjectMap<ITextureGL> mapTexturesGL = new GLObjectMap<>(8192);
|
||||
static final GLObjectMap<IQueryGL> mapQueriesGL = new GLObjectMap<>(8192);
|
||||
static final GLObjectMap<DisplayList> mapDisplayListsGL = new GLObjectMap<>(8192);
|
||||
@ -47,9 +89,9 @@ public class EaglercraftGPU {
|
||||
static final Logger logger = LogManager.getLogger("EaglercraftGPU");
|
||||
|
||||
static boolean emulatedVAOs = false;
|
||||
static SoftGLBufferState emulatedVAOState = new SoftGLBufferState();
|
||||
static SoftGLVertexState emulatedVAOState = new SoftGLVertexState();
|
||||
|
||||
public static final String gluErrorString(int i) {
|
||||
public static String gluErrorString(int i) {
|
||||
switch(i) {
|
||||
case GL_INVALID_ENUM: return "GL_INVALID_ENUM";
|
||||
case GL_INVALID_VALUE: return "GL_INVALID_VALUE";
|
||||
@ -61,22 +103,22 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void glTexParameteri(int target, int param, int value) {
|
||||
public static void glTexParameteri(int target, int param, int value) {
|
||||
_wglTexParameteri(target, param, value);
|
||||
}
|
||||
|
||||
public static final void glTexParameterf(int target, int param, float value) {
|
||||
public static void glTexParameterf(int target, int param, float value) {
|
||||
_wglTexParameterf(target, param, value);
|
||||
}
|
||||
|
||||
public static final void glCopyTexSubImage2D(int target, int level, int sx, int sy, int dx, int dy, int w, int h) {
|
||||
public static void glCopyTexSubImage2D(int target, int level, int sx, int sy, int dx, int dy, int w, int h) {
|
||||
_wglCopyTexSubImage2D(target, level, sx, sy, dx, dy, w, h);
|
||||
}
|
||||
|
||||
private static DisplayList currentList = null;
|
||||
private static ByteBuffer displayListBuffer = EagRuntime.allocateByteBuffer(0x100000);
|
||||
|
||||
public static final void glNewList(int target, int op) {
|
||||
public static void glNewList(int target, int op) {
|
||||
if(currentList != null) {
|
||||
throw new IllegalStateException("A display list is already being compiled you eagler!");
|
||||
}
|
||||
@ -88,18 +130,18 @@ public class EaglercraftGPU {
|
||||
throw new IllegalArgumentException("Unknown display list: " + target);
|
||||
}
|
||||
if(dp.vertexArray != null && dp.attribs > 0) {
|
||||
EaglercraftGPU.bindGLBufferArray(dp.vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(dp.vertexArray);
|
||||
int c = 0;
|
||||
if((dp.attribs & ATTRIB_TEXTURE) == ATTRIB_TEXTURE) {
|
||||
if((dp.attribs & ATTRIB_TEXTURE) != 0) {
|
||||
EaglercraftGPU.disableVertexAttribArray(++c);
|
||||
}
|
||||
if((dp.attribs & ATTRIB_COLOR) == ATTRIB_COLOR) {
|
||||
if((dp.attribs & ATTRIB_COLOR) != 0) {
|
||||
EaglercraftGPU.disableVertexAttribArray(++c);
|
||||
}
|
||||
if((dp.attribs & ATTRIB_NORMAL) == ATTRIB_NORMAL) {
|
||||
if((dp.attribs & ATTRIB_NORMAL) != 0) {
|
||||
EaglercraftGPU.disableVertexAttribArray(++c);
|
||||
}
|
||||
if((dp.attribs & ATTRIB_LIGHTMAP) == ATTRIB_LIGHTMAP) {
|
||||
if((dp.attribs & ATTRIB_LIGHTMAP) != 0) {
|
||||
EaglercraftGPU.disableVertexAttribArray(++c);
|
||||
}
|
||||
}
|
||||
@ -108,7 +150,7 @@ public class EaglercraftGPU {
|
||||
dp.count = 0;
|
||||
}
|
||||
|
||||
private static final void growDisplayListBuffer(int len) {
|
||||
private static void growDisplayListBuffer(int len) {
|
||||
int wantSize = displayListBuffer.position() + len;
|
||||
if(displayListBuffer.capacity() < wantSize) {
|
||||
int newSize = (wantSize & 0xFFFE0000) + 0x40000;
|
||||
@ -119,7 +161,7 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void glEndList() {
|
||||
public static void glEndList() {
|
||||
DisplayList dp = currentList;
|
||||
if(dp == null) {
|
||||
throw new IllegalStateException("No list is currently being compiled!");
|
||||
@ -127,11 +169,11 @@ public class EaglercraftGPU {
|
||||
|
||||
if(dp.attribs == -1) {
|
||||
if(dp.vertexArray != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(dp.vertexArray);
|
||||
destroyGLVertexArray(dp.vertexArray);
|
||||
dp.vertexArray = null;
|
||||
}
|
||||
if(dp.vertexBuffer != null) {
|
||||
_wglDeleteBuffers(dp.vertexBuffer);
|
||||
destroyGLArrayBuffer(dp.vertexBuffer);
|
||||
dp.vertexBuffer = null;
|
||||
}
|
||||
currentList = null;
|
||||
@ -139,7 +181,7 @@ public class EaglercraftGPU {
|
||||
}
|
||||
|
||||
if(dp.vertexArray == null) {
|
||||
dp.vertexArray = createGLBufferArray();
|
||||
dp.vertexArray = createGLVertexArray();
|
||||
dp.bindQuad16 = false;
|
||||
dp.bindQuad32 = false;
|
||||
}
|
||||
@ -156,14 +198,56 @@ public class EaglercraftGPU {
|
||||
currentList = null;
|
||||
}
|
||||
|
||||
public static final void glCallList(int displayList) {
|
||||
public static void uploadListDirect(int target, ByteBuffer buffer, int attrib, int mode, int count) {
|
||||
DisplayList dp = mapDisplayListsGL.get(target);
|
||||
if(dp == null) {
|
||||
throw new IllegalArgumentException("Unknown display list: " + target);
|
||||
}
|
||||
|
||||
if(dp.vertexArray != null && dp.attribs > 0) {
|
||||
EaglercraftGPU.bindGLVertexArray(dp.vertexArray);
|
||||
int c = 0;
|
||||
if((dp.attribs & ATTRIB_TEXTURE) != 0) {
|
||||
EaglercraftGPU.disableVertexAttribArray(++c);
|
||||
}
|
||||
if((dp.attribs & ATTRIB_COLOR) != 0) {
|
||||
EaglercraftGPU.disableVertexAttribArray(++c);
|
||||
}
|
||||
if((dp.attribs & ATTRIB_NORMAL) != 0) {
|
||||
EaglercraftGPU.disableVertexAttribArray(++c);
|
||||
}
|
||||
if((dp.attribs & ATTRIB_LIGHTMAP) != 0) {
|
||||
EaglercraftGPU.disableVertexAttribArray(++c);
|
||||
}
|
||||
}
|
||||
|
||||
if(dp.vertexArray == null) {
|
||||
dp.vertexArray = createGLVertexArray();
|
||||
dp.bindQuad16 = false;
|
||||
dp.bindQuad32 = false;
|
||||
}
|
||||
if(dp.vertexBuffer == null) {
|
||||
dp.vertexBuffer = createGLArrayBuffer();
|
||||
}
|
||||
|
||||
bindVAOGLArrayBufferNow(dp.vertexBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);
|
||||
|
||||
dp.attribs = attrib;
|
||||
FixedFunctionPipeline.setupDisplayList(dp);
|
||||
|
||||
dp.mode = mode;
|
||||
dp.count = count;
|
||||
}
|
||||
|
||||
public static void glCallList(int displayList) {
|
||||
DisplayList dp = mapDisplayListsGL.get(displayList);
|
||||
if(dp == null) {
|
||||
throw new NullPointerException("Tried to call a display list that does not exist: " + displayList);
|
||||
}
|
||||
if(dp.attribs != -1) {
|
||||
FixedFunctionPipeline p = FixedFunctionPipeline.setupRenderDisplayList(dp.attribs).update();
|
||||
bindGLBufferArray(dp.vertexArray);
|
||||
bindGLVertexArray(dp.vertexArray);
|
||||
if(dp.mode == GL_QUADS) {
|
||||
int cnt = dp.count;
|
||||
if(cnt > 0xFFFF) {
|
||||
@ -191,23 +275,23 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void flushDisplayList(int displayList) {
|
||||
public static void flushDisplayList(int displayList) {
|
||||
DisplayList dp = mapDisplayListsGL.get(displayList);
|
||||
if(dp == null) {
|
||||
throw new NullPointerException("Tried to flush a display list that does not exist: " + displayList);
|
||||
}
|
||||
dp.attribs = -1;
|
||||
if(dp.vertexArray != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(dp.vertexArray);
|
||||
EaglercraftGPU.destroyGLVertexArray(dp.vertexArray);
|
||||
dp.vertexArray = null;
|
||||
}
|
||||
if(dp.vertexBuffer != null) {
|
||||
_wglDeleteBuffers(dp.vertexBuffer);
|
||||
EaglercraftGPU.destroyGLArrayBuffer(dp.vertexBuffer);
|
||||
dp.vertexBuffer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void glNormal3f(float x, float y, float z) {
|
||||
public static void glNormal3f(float x, float y, float z) {
|
||||
GlStateManager.stateNormalX = x;
|
||||
GlStateManager.stateNormalY = y;
|
||||
GlStateManager.stateNormalZ = z;
|
||||
@ -216,7 +300,7 @@ public class EaglercraftGPU {
|
||||
|
||||
private static final IntObjectMap<String> stringCache = new IntObjectHashMap<>();
|
||||
|
||||
public static final String glGetString(int param) {
|
||||
public static String glGetString(int param) {
|
||||
String str = stringCache.get(param);
|
||||
if(str == null) {
|
||||
str = _wglGetString(param);
|
||||
@ -228,7 +312,7 @@ public class EaglercraftGPU {
|
||||
return str.length() == 0 ? null : str;
|
||||
}
|
||||
|
||||
public static final void glGetInteger(int param, int[] values) {
|
||||
public static void glGetInteger(int param, int[] values) {
|
||||
switch(param) {
|
||||
case GL_VIEWPORT:
|
||||
values[0] = GlStateManager.viewportX;
|
||||
@ -241,11 +325,11 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final int glGetInteger(int param) {
|
||||
public static int glGetInteger(int param) {
|
||||
return _wglGetInteger(param);
|
||||
}
|
||||
|
||||
public static final void glTexImage2D(int target, int level, int internalFormat, int w, int h, int unused,
|
||||
public static void glTexImage2D(int target, int level, int internalFormat, int w, int h, int unused,
|
||||
int format, int type, ByteBuffer pixels) {
|
||||
GlStateManager.setTextureCachedSize(target, w, h);
|
||||
if(glesVers >= 300) {
|
||||
@ -256,7 +340,7 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void glTexImage2D(int target, int level, int internalFormat, int w, int h, int unused,
|
||||
public static void glTexImage2D(int target, int level, int internalFormat, int w, int h, int unused,
|
||||
int format, int type, IntBuffer pixels) {
|
||||
GlStateManager.setTextureCachedSize(target, w, h);
|
||||
if(glesVers >= 300) {
|
||||
@ -267,12 +351,12 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void glTexSubImage2D(int target, int level, int x, int y, int w, int h, int format,
|
||||
public static void glTexSubImage2D(int target, int level, int x, int y, int w, int h, int format,
|
||||
int type, IntBuffer pixels) {
|
||||
_wglTexSubImage2D(target, level, x, y, w, h, format, type, pixels);
|
||||
}
|
||||
|
||||
public static final void glTexStorage2D(int target, int levels, int internalFormat, int w, int h) {
|
||||
public static void glTexStorage2D(int target, int levels, int internalFormat, int w, int h) {
|
||||
GlStateManager.setTextureCachedSize(target, w, h);
|
||||
if(texStorageCapable && (glesVers >= 300 || levels == 1 || (MathHelper.calculateLogBaseTwo(Math.max(w, h)) + 1) == levels)) {
|
||||
_wglTexStorage2D(target, levels, internalFormat, w, h);
|
||||
@ -285,7 +369,7 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer buffer) {
|
||||
public static void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer buffer) {
|
||||
switch(type) {
|
||||
case GL_FLOAT:
|
||||
_wglReadPixels(x, y, width, height, format, GL_FLOAT, buffer.asFloatBuffer());
|
||||
@ -300,11 +384,11 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void glLineWidth(float f) {
|
||||
public static void glLineWidth(float f) {
|
||||
_wglLineWidth(f);
|
||||
}
|
||||
|
||||
public static final void glFog(int param, FloatBuffer valueBuffer) {
|
||||
public static void glFog(int param, FloatBuffer valueBuffer) {
|
||||
int pos = valueBuffer.position();
|
||||
switch(param) {
|
||||
case GL_FOG_COLOR:
|
||||
@ -320,82 +404,94 @@ public class EaglercraftGPU {
|
||||
valueBuffer.position(pos);
|
||||
}
|
||||
|
||||
public static final void glFogi(int param, int value) {
|
||||
// I'm not sure what this is for currently
|
||||
}
|
||||
|
||||
public static final int glGenLists() {
|
||||
public static int glGenLists() {
|
||||
return mapDisplayListsGL.register(new DisplayList());
|
||||
}
|
||||
|
||||
public static final void glDeleteLists(int id) {
|
||||
public static void glDeleteLists(int id) {
|
||||
DisplayList d = mapDisplayListsGL.free(id);
|
||||
if(d != null) {
|
||||
if(d.vertexArray != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(d.vertexArray);
|
||||
destroyGLVertexArray(d.vertexArray);
|
||||
}
|
||||
if(d.vertexBuffer != null) {
|
||||
_wglDeleteBuffers(d.vertexBuffer);
|
||||
destroyGLArrayBuffer(d.vertexBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final int glGetError() {
|
||||
public static int glGetError() {
|
||||
return _wglGetError();
|
||||
}
|
||||
|
||||
public static final void glBlendEquation(int equation) {
|
||||
public static void glBlendEquation(int equation) {
|
||||
if(equation != GlStateManager.stateBlendEquation) {
|
||||
_wglBlendEquation(equation);
|
||||
GlStateManager.stateBlendEquation = equation;
|
||||
}
|
||||
}
|
||||
|
||||
public static final boolean areVAOsEmulated() {
|
||||
public static IBufferGL createGLArrayBuffer() {
|
||||
return arrayBufferRecycler.create();
|
||||
}
|
||||
|
||||
public static void destroyGLArrayBuffer(IBufferGL buffer) {
|
||||
arrayBufferRecycler.destroy(buffer);
|
||||
}
|
||||
|
||||
public static IBufferGL createGLElementArrayBuffer() {
|
||||
return elementArrayBufferRecycler.create();
|
||||
}
|
||||
|
||||
public static void destroyGLElementArrayBuffer(IBufferGL buffer) {
|
||||
elementArrayBufferRecycler.destroy(buffer);
|
||||
}
|
||||
|
||||
public static boolean areVAOsEmulated() {
|
||||
return emulatedVAOs;
|
||||
}
|
||||
|
||||
public static final IBufferArrayGL createGLBufferArray() {
|
||||
public static IVertexArrayGL createGLVertexArray() {
|
||||
if(emulatedVAOs) {
|
||||
return new SoftGLBufferArray();
|
||||
return new SoftGLVertexArray();
|
||||
}else {
|
||||
return _wglGenVertexArrays();
|
||||
return VAORecycler.create();
|
||||
}
|
||||
}
|
||||
|
||||
public static final void destroyGLBufferArray(IBufferArrayGL buffer) {
|
||||
public static void destroyGLVertexArray(IVertexArrayGL buffer) {
|
||||
if(!emulatedVAOs) {
|
||||
_wglDeleteVertexArrays(buffer);
|
||||
VAORecycler.destroy(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void enableVertexAttribArray(int index) {
|
||||
public static void enableVertexAttribArray(int index) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping enable attrib with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).enableAttrib(index, true);
|
||||
((SoftGLVertexArray)currentVertexArray).enableAttrib(index, true);
|
||||
}else {
|
||||
_wglEnableVertexAttribArray(index);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void disableVertexAttribArray(int index) {
|
||||
public static void disableVertexAttribArray(int index) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping disable attrib with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).enableAttrib(index, false);
|
||||
((SoftGLVertexArray)currentVertexArray).enableAttrib(index, false);
|
||||
}else {
|
||||
_wglDisableVertexAttribArray(index);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void vertexAttribPointer(int index, int size, int format, boolean normalized, int stride, int offset) {
|
||||
public static void vertexAttribPointer(int index, int size, int format, boolean normalized, int stride, int offset) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping vertexAttribPointer with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
@ -403,77 +499,77 @@ public class EaglercraftGPU {
|
||||
logger.warn("Skipping vertexAttribPointer with emulated VAO because no VAO array buffer is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).setAttrib(currentVAOArrayBuffer, index, size, format, normalized, stride, offset);
|
||||
((SoftGLVertexArray)currentVertexArray).setAttrib(currentVAOArrayBuffer, index, size, format, normalized, stride, offset);
|
||||
}else {
|
||||
_wglVertexAttribPointer(index, size, format, normalized, stride, offset);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void vertexAttribDivisor(int index, int divisor) {
|
||||
public static void vertexAttribDivisor(int index, int divisor) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping vertexAttribPointer with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).setAttribDivisor(index, divisor);
|
||||
((SoftGLVertexArray)currentVertexArray).setAttribDivisor(index, divisor);
|
||||
}else {
|
||||
_wglVertexAttribDivisor(index, divisor);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void doDrawArrays(int mode, int first, int count) {
|
||||
public static void drawArrays(int mode, int first, int count) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping draw call with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).transitionToState(emulatedVAOState, false);
|
||||
((SoftGLVertexArray)currentVertexArray).transitionToState(emulatedVAOState, false);
|
||||
}
|
||||
_wglDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
public static final void doDrawElements(int mode, int count, int type, int offset) {
|
||||
public static void drawElements(int mode, int count, int type, int offset) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping draw call with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).transitionToState(emulatedVAOState, true);
|
||||
((SoftGLVertexArray)currentVertexArray).transitionToState(emulatedVAOState, true);
|
||||
}
|
||||
_wglDrawElements(mode, count, type, offset);
|
||||
}
|
||||
|
||||
public static final void doDrawArraysInstanced(int mode, int first, int count, int instances) {
|
||||
public static void drawArraysInstanced(int mode, int first, int count, int instances) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping instanced draw call with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).transitionToState(emulatedVAOState, false);
|
||||
((SoftGLVertexArray)currentVertexArray).transitionToState(emulatedVAOState, false);
|
||||
}
|
||||
_wglDrawArraysInstanced(mode, first, count, instances);
|
||||
}
|
||||
|
||||
public static final void doDrawElementsInstanced(int mode, int count, int type, int offset, int instances) {
|
||||
public static void drawElementsInstanced(int mode, int count, int type, int offset, int instances) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping instanced draw call with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).transitionToState(emulatedVAOState, true);
|
||||
((SoftGLVertexArray)currentVertexArray).transitionToState(emulatedVAOState, true);
|
||||
}
|
||||
_wglDrawElementsInstanced(mode, count, type, offset, instances);
|
||||
}
|
||||
|
||||
static IBufferArrayGL currentBufferArray = null;
|
||||
static IVertexArrayGL currentVertexArray = null;
|
||||
|
||||
public static final void bindGLBufferArray(IBufferArrayGL buffer) {
|
||||
public static void bindGLVertexArray(IVertexArrayGL buffer) {
|
||||
if(emulatedVAOs) {
|
||||
currentBufferArray = buffer;
|
||||
currentVertexArray = buffer;
|
||||
}else {
|
||||
if(currentBufferArray != buffer) {
|
||||
if(currentVertexArray != buffer) {
|
||||
_wglBindVertexArray(buffer);
|
||||
currentBufferArray = buffer;
|
||||
currentVertexArray = buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -483,7 +579,10 @@ public class EaglercraftGPU {
|
||||
// only used when VAOs are emulated
|
||||
static IBufferGL currentVAOArrayBuffer = null;
|
||||
|
||||
public static final void bindVAOGLArrayBuffer(IBufferGL buffer) {
|
||||
/**
|
||||
* Binds a buffer to use only for calls to vertexAttribPointer
|
||||
*/
|
||||
public static void bindVAOGLArrayBuffer(IBufferGL buffer) {
|
||||
if(emulatedVAOs) {
|
||||
currentVAOArrayBuffer = buffer;
|
||||
}else {
|
||||
@ -494,7 +593,10 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void bindVAOGLArrayBufferNow(IBufferGL buffer) {
|
||||
/**
|
||||
* Binds a buffer to use for calls to vertexAttribPointer and the GL_ARRAY_BUFFER target
|
||||
*/
|
||||
public static void bindVAOGLArrayBufferNow(IBufferGL buffer) {
|
||||
if(emulatedVAOs) {
|
||||
currentVAOArrayBuffer = buffer;
|
||||
}
|
||||
@ -504,25 +606,28 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void bindVAOGLElementArrayBuffer(IBufferGL buffer) {
|
||||
/**
|
||||
* Binds an index buffer to the current vertex array
|
||||
*/
|
||||
public static void bindVAOGLElementArrayBuffer(IBufferGL buffer) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping set element array buffer with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).setIndexBuffer(buffer);
|
||||
((SoftGLVertexArray)currentVertexArray).setIndexBuffer(buffer);
|
||||
}else {
|
||||
_wglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
static final void bindVAOGLElementArrayBufferNow(IBufferGL buffer) {
|
||||
static void bindVAOGLElementArrayBufferNow(IBufferGL buffer) {
|
||||
if(emulatedVAOs) {
|
||||
if(currentBufferArray == null) {
|
||||
if(currentVertexArray == null) {
|
||||
logger.warn("Skipping set element array buffer with emulated VAO because no known VAO is bound!");
|
||||
return;
|
||||
}
|
||||
((SoftGLBufferArray)currentBufferArray).setIndexBuffer(buffer);
|
||||
((SoftGLVertexArray)currentVertexArray).setIndexBuffer(buffer);
|
||||
if(currentEmulatedVAOIndexBuffer != buffer) {
|
||||
_wglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer);
|
||||
currentEmulatedVAOIndexBuffer = buffer;
|
||||
@ -534,14 +639,17 @@ public class EaglercraftGPU {
|
||||
|
||||
static IBufferGL currentEmulatedVAOIndexBuffer = null;
|
||||
|
||||
static final void bindEmulatedVAOIndexBuffer(IBufferGL buffer) {
|
||||
static void bindEmulatedVAOIndexBuffer(IBufferGL buffer) {
|
||||
if(currentEmulatedVAOIndexBuffer != buffer) {
|
||||
_wglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer);
|
||||
currentEmulatedVAOIndexBuffer = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void bindGLArrayBuffer(IBufferGL buffer) {
|
||||
/**
|
||||
* Binds a buffer to the GL_ARRAY_BUFFER target for use not related to vertexAttribPointer
|
||||
*/
|
||||
public static void bindGLArrayBuffer(IBufferGL buffer) {
|
||||
if(currentArrayBuffer != buffer) {
|
||||
_wglBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
currentArrayBuffer = buffer;
|
||||
@ -549,8 +657,11 @@ public class EaglercraftGPU {
|
||||
}
|
||||
|
||||
static IBufferGL currentUniformBuffer = null;
|
||||
|
||||
public static final void bindGLUniformBuffer(IBufferGL buffer) {
|
||||
|
||||
/**
|
||||
* Binds a buffer to the GL_UNIFORM_BUFFER target
|
||||
*/
|
||||
public static void bindGLUniformBuffer(IBufferGL buffer) {
|
||||
if(currentUniformBuffer != buffer) {
|
||||
_wglBindBuffer(0x8A11, buffer);
|
||||
currentUniformBuffer = buffer;
|
||||
@ -559,7 +670,7 @@ public class EaglercraftGPU {
|
||||
|
||||
static IProgramGL currentShaderProgram = null;
|
||||
|
||||
public static final void bindGLShaderProgram(IProgramGL prog) {
|
||||
public static void bindGLShaderProgram(IProgramGL prog) {
|
||||
if(currentShaderProgram != prog) {
|
||||
_wglUseProgram(prog);
|
||||
currentShaderProgram = prog;
|
||||
@ -570,7 +681,7 @@ public class EaglercraftGPU {
|
||||
private static final int[] currentUniformBlockBindingOffset = new int[16];
|
||||
private static final int[] currentUniformBlockBindingSize = new int[16];
|
||||
|
||||
public static final void bindUniformBufferRange(int index, IBufferGL buffer, int offset, int size) {
|
||||
public static void bindUniformBufferRange(int index, IBufferGL buffer, int offset, int size) {
|
||||
if(currentUniformBlockBindings[index] != buffer || currentUniformBlockBindingOffset[index] != offset
|
||||
|| currentUniformBlockBindingSize[index] != size) {
|
||||
_wglBindBufferRange(0x8A11, index, buffer, offset, size);
|
||||
@ -587,7 +698,7 @@ public class EaglercraftGPU {
|
||||
public static final int CLEAR_BINDING_ARRAY_BUFFER = 16;
|
||||
public static final int CLEAR_BINDING_SHADER_PROGRAM = 32;
|
||||
|
||||
public static final void clearCurrentBinding(int mask) {
|
||||
public static void clearCurrentBinding(int mask) {
|
||||
if((mask & CLEAR_BINDING_TEXTURE) != 0) {
|
||||
int[] i = GlStateManager.boundTexture;
|
||||
for(int j = 0; j < i.length; ++j) {
|
||||
@ -602,7 +713,7 @@ public class EaglercraftGPU {
|
||||
_wglActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
if((mask & CLEAR_BINDING_BUFFER_ARRAY) != 0) {
|
||||
currentBufferArray = null;
|
||||
currentVertexArray = null;
|
||||
}
|
||||
if((mask & CLEAR_BINDING_ARRAY_BUFFER) != 0) {
|
||||
currentArrayBuffer = currentVAOArrayBuffer = null;
|
||||
@ -617,7 +728,7 @@ public class EaglercraftGPU {
|
||||
public static final int ATTRIB_NORMAL = 4;
|
||||
public static final int ATTRIB_LIGHTMAP = 8;
|
||||
|
||||
public static final void renderBuffer(ByteBuffer buffer, int attrib, int mode, int count) {
|
||||
public static void renderBuffer(ByteBuffer buffer, int attrib, int mode, int count) {
|
||||
if(currentList != null) {
|
||||
if(currentList.attribs == -1) {
|
||||
currentList.attribs = attrib;
|
||||
@ -643,19 +754,27 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void optimize() {
|
||||
private static long lastRecyclerFlush = 0l;
|
||||
|
||||
public static void optimize() {
|
||||
FixedFunctionPipeline.optimize();
|
||||
long millis = EagRuntime.steadyTimeMillis();
|
||||
if(millis - lastRecyclerFlush > 120000l) {
|
||||
lastRecyclerFlush = millis;
|
||||
arrayBufferRecycler.compact();
|
||||
VAORecycler.compact();
|
||||
}
|
||||
}
|
||||
|
||||
private static FixedFunctionPipeline lastRender = null;
|
||||
private static int lastMode = 0;
|
||||
private static int lastCount = 0;
|
||||
|
||||
public static final void renderAgain() {
|
||||
public static void renderAgain() {
|
||||
if(lastRender == null) {
|
||||
throw new UnsupportedOperationException("Cannot render the same verticies twice while generating display list");
|
||||
}
|
||||
EaglercraftGPU.bindGLBufferArray(lastRender.getDirectModeBufferArray());
|
||||
EaglercraftGPU.bindGLVertexArray(lastRender.getDirectModeVertexArray());
|
||||
lastRender.update().drawDirectArrays(lastMode, 0, lastCount);
|
||||
}
|
||||
|
||||
@ -665,7 +784,7 @@ public class EaglercraftGPU {
|
||||
private static IBufferGL quad32EmulationBuffer = null;
|
||||
private static int quad32EmulationBufferSize = 0;
|
||||
|
||||
public static final void attachQuad16EmulationBuffer(int vertexCount, boolean bind) {
|
||||
public static void attachQuad16EmulationBuffer(int vertexCount, boolean bind) {
|
||||
IBufferGL buf = quad16EmulationBuffer;
|
||||
if(buf == null) {
|
||||
quad16EmulationBuffer = buf = _wglGenBuffers();
|
||||
@ -690,7 +809,7 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void attachQuad32EmulationBuffer(int vertexCount, boolean bind) {
|
||||
public static void attachQuad32EmulationBuffer(int vertexCount, boolean bind) {
|
||||
IBufferGL buf = quad32EmulationBuffer;
|
||||
if(buf == null) {
|
||||
quad32EmulationBuffer = buf = _wglGenBuffers();
|
||||
@ -709,7 +828,7 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
private static final void resizeQuad16EmulationBuffer(int quadCount) {
|
||||
private static void resizeQuad16EmulationBuffer(int quadCount) {
|
||||
IntBuffer buf = EagRuntime.allocateIntBuffer(quadCount * 3);
|
||||
int v1, v2, v3, v4;
|
||||
for(int i = 0; i < quadCount; ++i) {
|
||||
@ -726,7 +845,7 @@ public class EaglercraftGPU {
|
||||
EagRuntime.freeIntBuffer(buf);
|
||||
}
|
||||
|
||||
private static final void resizeQuad32EmulationBuffer(int quadCount) {
|
||||
private static void resizeQuad32EmulationBuffer(int quadCount) {
|
||||
IntBuffer buf = EagRuntime.allocateIntBuffer(quadCount * 6);
|
||||
int v1, v2, v3, v4;
|
||||
for(int i = 0; i < quadCount; ++i) {
|
||||
@ -743,11 +862,11 @@ public class EaglercraftGPU {
|
||||
EagRuntime.freeIntBuffer(buf);
|
||||
}
|
||||
|
||||
public static final ITextureGL getNativeTexture(int tex) {
|
||||
public static ITextureGL getNativeTexture(int tex) {
|
||||
return mapTexturesGL.get(tex);
|
||||
}
|
||||
|
||||
public static final void regenerateTexture(int tex) {
|
||||
public static void regenerateTexture(int tex) {
|
||||
ITextureGL webglTex = mapTexturesGL.get(tex);
|
||||
if(webglTex != null) {
|
||||
GlStateManager.unbindTextureIfCached(tex);
|
||||
@ -758,12 +877,12 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void drawHighPoly(HighPolyMesh mesh) {
|
||||
public static void drawHighPoly(HighPolyMesh mesh) {
|
||||
if(mesh.vertexCount == 0 || mesh.indexCount == 0 || mesh.vertexArray == null) {
|
||||
return;
|
||||
}
|
||||
FixedFunctionPipeline p = FixedFunctionPipeline.setupRenderDisplayList(mesh.getAttribBits()).update();
|
||||
EaglercraftGPU.bindGLBufferArray(mesh.vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(mesh.vertexArray);
|
||||
p.drawElements(GL_TRIANGLES, mesh.indexCount, GL_UNSIGNED_SHORT, 0);
|
||||
}
|
||||
|
||||
@ -781,15 +900,15 @@ public class EaglercraftGPU {
|
||||
static boolean npotCapable = false;
|
||||
static int uniformBufferOffsetAlignment = -1;
|
||||
|
||||
public static final void createFramebufferHDR16FTexture(int target, int level, int w, int h, int format, boolean allow32bitFallback) {
|
||||
public static void createFramebufferHDR16FTexture(int target, int level, int w, int h, int format, boolean allow32bitFallback) {
|
||||
createFramebufferHDR16FTexture(target, level, w, h, format, allow32bitFallback, null);
|
||||
}
|
||||
|
||||
public static final void createFramebufferHDR16FTexture(int target, int level, int w, int h, int format, ByteBuffer pixelData) {
|
||||
public static void createFramebufferHDR16FTexture(int target, int level, int w, int h, int format, ByteBuffer pixelData) {
|
||||
createFramebufferHDR16FTexture(target, level, w, h, format, false, pixelData);
|
||||
}
|
||||
|
||||
private static final void createFramebufferHDR16FTexture(int target, int level, int w, int h, int format, boolean allow32bitFallback, ByteBuffer pixelData) {
|
||||
private static void createFramebufferHDR16FTexture(int target, int level, int w, int h, int format, boolean allow32bitFallback, ByteBuffer pixelData) {
|
||||
if(hasFramebufferHDR16FSupport) {
|
||||
int internalFormat;
|
||||
switch(format) {
|
||||
@ -825,15 +944,15 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void createFramebufferHDR32FTexture(int target, int level, int w, int h, int format, boolean allow16bitFallback) {
|
||||
public static void createFramebufferHDR32FTexture(int target, int level, int w, int h, int format, boolean allow16bitFallback) {
|
||||
createFramebufferHDR32FTexture(target, level, w, h, format, allow16bitFallback, null);
|
||||
}
|
||||
|
||||
public static final void createFramebufferHDR32FTexture(int target, int level, int w, int h, int format, ByteBuffer pixelData) {
|
||||
public static void createFramebufferHDR32FTexture(int target, int level, int w, int h, int format, ByteBuffer pixelData) {
|
||||
createFramebufferHDR32FTexture(target, level, w, h, format, false, pixelData);
|
||||
}
|
||||
|
||||
private static final void createFramebufferHDR32FTexture(int target, int level, int w, int h, int format, boolean allow16bitFallback, ByteBuffer pixelData) {
|
||||
private static void createFramebufferHDR32FTexture(int target, int level, int w, int h, int format, boolean allow16bitFallback, ByteBuffer pixelData) {
|
||||
if(hasFramebufferHDR32FSupport) {
|
||||
int internalFormat;
|
||||
switch(format) {
|
||||
@ -864,7 +983,7 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void warmUpCache() {
|
||||
public static void warmUpCache() {
|
||||
EaglercraftGPU.glGetString(7936);
|
||||
EaglercraftGPU.glGetString(7937);
|
||||
EaglercraftGPU.glGetString(7938);
|
||||
@ -914,7 +1033,7 @@ public class EaglercraftGPU {
|
||||
if(!instancingCapable) {
|
||||
logger.info("Note: Could not unlock instancing via OpenGL extensions, using slow vanilla font and particle rendering");
|
||||
}
|
||||
emulatedVAOState = emulatedVAOs ? new SoftGLBufferState() : null;
|
||||
emulatedVAOState = emulatedVAOs ? new SoftGLVertexState() : null;
|
||||
PlatformOpenGL.enterVAOEmulationHook();
|
||||
GLSLHeader.init();
|
||||
DrawUtils.init();
|
||||
@ -928,7 +1047,7 @@ public class EaglercraftGPU {
|
||||
DrawUtils.vshLocal = null;
|
||||
}
|
||||
|
||||
public static final void destroyCache() {
|
||||
public static void destroyCache() {
|
||||
GLSLHeader.destroy();
|
||||
DrawUtils.destroy();
|
||||
InstancedFontRenderer.destroy();
|
||||
@ -952,43 +1071,43 @@ public class EaglercraftGPU {
|
||||
mapDisplayListsGL.clear();
|
||||
}
|
||||
|
||||
public static final int checkOpenGLESVersion() {
|
||||
public static int checkOpenGLESVersion() {
|
||||
return glesVers;
|
||||
}
|
||||
|
||||
public static final boolean checkFBORenderMipmapCapable() {
|
||||
public static boolean checkFBORenderMipmapCapable() {
|
||||
return fboRenderMipmapCapable;
|
||||
}
|
||||
|
||||
public static final boolean checkVAOCapable() {
|
||||
public static boolean checkVAOCapable() {
|
||||
return vertexArrayCapable;
|
||||
}
|
||||
|
||||
public static final boolean checkInstancingCapable() {
|
||||
public static boolean checkInstancingCapable() {
|
||||
return instancingCapable;
|
||||
}
|
||||
|
||||
public static final boolean checkTexStorageCapable() {
|
||||
public static boolean checkTexStorageCapable() {
|
||||
return texStorageCapable;
|
||||
}
|
||||
|
||||
public static final boolean checkTextureLODCapable() {
|
||||
public static boolean checkTextureLODCapable() {
|
||||
return textureLODCapable;
|
||||
}
|
||||
|
||||
public static final boolean checkShader5Capable() {
|
||||
public static boolean checkShader5Capable() {
|
||||
return shader5Capable;
|
||||
}
|
||||
|
||||
public static final boolean checkNPOTCapable() {
|
||||
public static boolean checkNPOTCapable() {
|
||||
return npotCapable;
|
||||
}
|
||||
|
||||
public static final int getUniformBufferOffsetAlignment() {
|
||||
public static int getUniformBufferOffsetAlignment() {
|
||||
return uniformBufferOffsetAlignment;
|
||||
}
|
||||
|
||||
public static final boolean checkHDRFramebufferSupport(int bits) {
|
||||
public static boolean checkHDRFramebufferSupport(int bits) {
|
||||
switch(bits) {
|
||||
case 16:
|
||||
return hasFramebufferHDR16FSupport;
|
||||
@ -999,7 +1118,7 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final boolean checkLinearHDRFilteringSupport(int bits) {
|
||||
public static boolean checkLinearHDRFilteringSupport(int bits) {
|
||||
switch(bits) {
|
||||
case 16:
|
||||
return hasLinearHDR16FSupport;
|
||||
@ -1010,16 +1129,16 @@ public class EaglercraftGPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static final boolean checkHasHDRFramebufferSupport() {
|
||||
public static boolean checkHasHDRFramebufferSupport() {
|
||||
return hasFramebufferHDR16FSupport || hasFramebufferHDR32FSupport;
|
||||
}
|
||||
|
||||
public static final boolean checkHasHDRFramebufferSupportWithFilter() {
|
||||
public static boolean checkHasHDRFramebufferSupportWithFilter() {
|
||||
return (hasFramebufferHDR16FSupport && hasLinearHDR16FSupport) || (hasFramebufferHDR32FSupport && hasLinearHDR32FSupport);
|
||||
}
|
||||
|
||||
//legacy
|
||||
public static final boolean checkLinearHDR32FSupport() {
|
||||
public static boolean checkLinearHDR32FSupport() {
|
||||
return hasLinearHDR32FSupport;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
|
||||
@ -47,7 +47,7 @@ public class FixedFunctionPipeline {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger("FixedFunctionPipeline");
|
||||
|
||||
static final int getFragmentState() {
|
||||
static int getFragmentState() {
|
||||
return (GlStateManager.stateTexture[0] ? STATE_ENABLE_TEXTURE2D : 0) |
|
||||
(GlStateManager.stateTexture[1] ? STATE_ENABLE_LIGHTMAP : 0) |
|
||||
(GlStateManager.stateAlphaTest ? STATE_ENABLE_ALPHA_TEST : 0) |
|
||||
@ -77,7 +77,7 @@ public class FixedFunctionPipeline {
|
||||
StreamBufferInstance sb = self.streamBuffer.getBuffer(buffer.remaining());
|
||||
self.currentVertexArray = sb;
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(sb.getVertexArray());
|
||||
EaglercraftGPU.bindGLVertexArray(sb.getVertexArray());
|
||||
EaglercraftGPU.bindGLArrayBuffer(sb.getVertexBuffer());
|
||||
|
||||
_wglBufferSubData(GL_ARRAY_BUFFER, 0, buffer);
|
||||
@ -98,7 +98,7 @@ public class FixedFunctionPipeline {
|
||||
self = getPipelineInstanceCore(baseState);
|
||||
}
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(list.vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(list.vertexArray);
|
||||
EaglercraftGPU.bindVAOGLArrayBuffer(list.vertexBuffer);
|
||||
|
||||
EaglercraftGPU.enableVertexAttribArray(0);
|
||||
@ -146,7 +146,7 @@ public class FixedFunctionPipeline {
|
||||
|
||||
void drawArrays(int mode, int offset, int count) {
|
||||
EaglercraftGPU.bindGLShaderProgram(shaderProgram);
|
||||
EaglercraftGPU.doDrawArrays(mode, offset, count);
|
||||
EaglercraftGPU.drawArrays(mode, offset, count);
|
||||
}
|
||||
|
||||
void drawDirectArrays(int mode, int offset, int count) {
|
||||
@ -161,7 +161,7 @@ public class FixedFunctionPipeline {
|
||||
}else {
|
||||
EaglercraftGPU.attachQuad32EmulationBuffer(count, false);
|
||||
}
|
||||
EaglercraftGPU.doDrawElements(GL_TRIANGLES, count + (count >> 1),
|
||||
EaglercraftGPU.drawElements(GL_TRIANGLES, count + (count >> 1),
|
||||
GL_UNSIGNED_INT, 0);
|
||||
}else {
|
||||
if(!sb.bindQuad16) {
|
||||
@ -171,17 +171,17 @@ public class FixedFunctionPipeline {
|
||||
}else {
|
||||
EaglercraftGPU.attachQuad16EmulationBuffer(count, false);
|
||||
}
|
||||
EaglercraftGPU.doDrawElements(GL_TRIANGLES, count + (count >> 1),
|
||||
EaglercraftGPU.drawElements(GL_TRIANGLES, count + (count >> 1),
|
||||
GL_UNSIGNED_SHORT, 0);
|
||||
}
|
||||
}else {
|
||||
EaglercraftGPU.doDrawArrays(mode, offset, count);
|
||||
EaglercraftGPU.drawArrays(mode, offset, count);
|
||||
}
|
||||
}
|
||||
|
||||
void drawElements(int mode, int count, int type, int offset) {
|
||||
EaglercraftGPU.bindGLShaderProgram(shaderProgram);
|
||||
EaglercraftGPU.doDrawElements(mode, count, type, offset);
|
||||
EaglercraftGPU.drawElements(mode, count, type, offset);
|
||||
}
|
||||
|
||||
private static IExtPipelineCompiler extensionProvider;
|
||||
@ -576,7 +576,7 @@ public class FixedFunctionPipeline {
|
||||
|
||||
streamBuffer = new StreamBuffer(FixedFunctionShader.initialSize, FixedFunctionShader.initialCount,
|
||||
FixedFunctionShader.maxCount, (vertexArray, vertexBuffer) -> {
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
EaglercraftGPU.bindVAOGLArrayBuffer(vertexBuffer);
|
||||
|
||||
EaglercraftGPU.enableVertexAttribArray(0);
|
||||
@ -1103,7 +1103,7 @@ public class FixedFunctionPipeline {
|
||||
streamBuffer.destroy();
|
||||
}
|
||||
|
||||
public IBufferArrayGL getDirectModeBufferArray() {
|
||||
public IVertexArrayGL getDirectModeVertexArray() {
|
||||
return currentVertexArray.vertexArray;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2025 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.opengl;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
|
||||
public abstract class GLObjectRecycler<T> {
|
||||
|
||||
private Deque<T> deletedObjects;
|
||||
|
||||
private final int reserveSize;
|
||||
|
||||
public GLObjectRecycler(int reserveSize) {
|
||||
this.reserveSize = reserveSize;
|
||||
this.deletedObjects = new ArrayDeque<>(reserveSize << 1);
|
||||
}
|
||||
|
||||
public T createObject() {
|
||||
T ret = deletedObjects.pollLast();
|
||||
if(ret != null) {
|
||||
return ret;
|
||||
}else {
|
||||
return create();
|
||||
}
|
||||
}
|
||||
|
||||
public void destroyObject(T obj) {
|
||||
deletedObjects.addLast(obj);
|
||||
}
|
||||
|
||||
public void compact() {
|
||||
while(deletedObjects.size() > reserveSize) {
|
||||
destroy(deletedObjects.removeFirst());
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract T create();
|
||||
|
||||
protected abstract void destroy(T object);
|
||||
|
||||
}
|
@ -121,10 +121,10 @@ public class GlStateManager {
|
||||
|
||||
static int colorMaskBits = 15;
|
||||
|
||||
static float clearColorR = 0.0f;
|
||||
static float clearColorG = 0.0f;
|
||||
static float clearColorB = 0.0f;
|
||||
static float clearColorA = 1.0f;
|
||||
static float clearColorR = -999.0f;
|
||||
static float clearColorG = -999.0f;
|
||||
static float clearColorB = -999.0f;
|
||||
static float clearColorA = -999.0f;
|
||||
|
||||
static float clearDepth = -999.0f;
|
||||
|
||||
@ -196,7 +196,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void pushLightCoords() {
|
||||
public static void pushLightCoords() {
|
||||
int push = stateLightsStackPointer + 1;
|
||||
if(push < stateLightsStack.length) {
|
||||
Vector4f[] copyFrom = stateLightsStack[stateLightsStackPointer];
|
||||
@ -220,7 +220,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void popLightCoords() {
|
||||
public static void popLightCoords() {
|
||||
if(stateLightsStackPointer > 0) {
|
||||
--stateLightsStackPointer;
|
||||
}else {
|
||||
@ -230,15 +230,15 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void disableAlpha() {
|
||||
public static void disableAlpha() {
|
||||
stateAlphaTest = false;
|
||||
}
|
||||
|
||||
public static final void enableAlpha() {
|
||||
public static void enableAlpha() {
|
||||
stateAlphaTest = true;
|
||||
}
|
||||
|
||||
public static final void alphaFunc(int func, float ref) {
|
||||
public static void alphaFunc(int func, float ref) {
|
||||
if(func != GL_GREATER) {
|
||||
throw new UnsupportedOperationException("Only GL_GREATER alphaFunc is supported");
|
||||
}else {
|
||||
@ -246,28 +246,28 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void enableLighting() {
|
||||
public static void enableLighting() {
|
||||
stateLighting = true;
|
||||
}
|
||||
|
||||
public static final void disableLighting() {
|
||||
public static void disableLighting() {
|
||||
stateLighting = false;
|
||||
}
|
||||
|
||||
public static final void enableExtensionPipeline() {
|
||||
public static void enableExtensionPipeline() {
|
||||
stateUseExtensionPipeline = true;
|
||||
}
|
||||
|
||||
public static final void disableExtensionPipeline() {
|
||||
public static void disableExtensionPipeline() {
|
||||
stateUseExtensionPipeline = false;
|
||||
}
|
||||
|
||||
public static final boolean isExtensionPipeline() {
|
||||
public static boolean isExtensionPipeline() {
|
||||
return stateUseExtensionPipeline;
|
||||
}
|
||||
|
||||
private static final Vector4f paramVector4 = new Vector4f();
|
||||
public static final void enableMCLight(int light, float diffuse, double dirX,
|
||||
public static void enableMCLight(int light, float diffuse, double dirX,
|
||||
double dirY, double dirZ, double dirW) {
|
||||
if(dirW != 0.0) throw new IllegalArgumentException("dirW must be 0.0!");
|
||||
paramVector4.x = (float)dirX;
|
||||
@ -287,47 +287,47 @@ public class GlStateManager {
|
||||
++stateLightingSerial[stateLightsStackPointer];
|
||||
}
|
||||
|
||||
public static final void disableMCLight(int light) {
|
||||
public static void disableMCLight(int light) {
|
||||
stateLightsEnabled[stateLightsStackPointer][light] = false;
|
||||
++stateLightingSerial[stateLightsStackPointer];
|
||||
}
|
||||
|
||||
public static final void setMCLightAmbient(float r, float g, float b) {
|
||||
public static void setMCLightAmbient(float r, float g, float b) {
|
||||
stateLightingAmbientR = r;
|
||||
stateLightingAmbientG = g;
|
||||
stateLightingAmbientB = b;
|
||||
++stateLightingAmbientSerial;
|
||||
}
|
||||
|
||||
public static final void enableColorMaterial() {
|
||||
public static void enableColorMaterial() {
|
||||
stateMaterial = true;
|
||||
}
|
||||
|
||||
public static final void disableColorMaterial() {
|
||||
public static void disableColorMaterial() {
|
||||
stateMaterial = false;
|
||||
}
|
||||
|
||||
public static final void disableDepth() {
|
||||
public static void disableDepth() {
|
||||
if(stateDepthTest) {
|
||||
_wglDisable(GL_DEPTH_TEST);
|
||||
stateDepthTest = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void enableDepth() {
|
||||
public static void enableDepth() {
|
||||
if(!stateDepthTest) {
|
||||
_wglEnable(GL_DEPTH_TEST);
|
||||
stateDepthTest = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void eagPushStateForGLES2BlitHack() {
|
||||
public static void eagPushStateForGLES2BlitHack() {
|
||||
stateDepthTestStash = stateDepthTest;
|
||||
stateCullStash = stateCull;
|
||||
stateBlendStash = stateBlend;
|
||||
}
|
||||
|
||||
public static final void eagPopStateForGLES2BlitHack() {
|
||||
public static void eagPopStateForGLES2BlitHack() {
|
||||
if(stateDepthTestStash) {
|
||||
enableDepth();
|
||||
}else {
|
||||
@ -345,7 +345,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void depthFunc(int depthFunc) {
|
||||
public static void depthFunc(int depthFunc) {
|
||||
int rev = depthFunc;
|
||||
switch(depthFunc) {
|
||||
case GL_GREATER:
|
||||
@ -370,42 +370,42 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void depthMask(boolean flagIn) {
|
||||
public static void depthMask(boolean flagIn) {
|
||||
if(flagIn != stateDepthMask) {
|
||||
_wglDepthMask(flagIn);
|
||||
stateDepthMask = flagIn;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void disableBlend() {
|
||||
public static void disableBlend() {
|
||||
if(stateBlend) {
|
||||
if(stateGlobalBlend) _wglDisable(GL_BLEND);
|
||||
stateBlend = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void enableBlend() {
|
||||
public static void enableBlend() {
|
||||
if(!stateBlend) {
|
||||
if(stateGlobalBlend) _wglEnable(GL_BLEND);
|
||||
stateBlend = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void globalDisableBlend() {
|
||||
public static void globalDisableBlend() {
|
||||
if(stateBlend) {
|
||||
_wglDisable(GL_BLEND);
|
||||
}
|
||||
stateGlobalBlend = false;
|
||||
}
|
||||
|
||||
public static final void globalEnableBlend() {
|
||||
public static void globalEnableBlend() {
|
||||
if(stateBlend) {
|
||||
_wglEnable(GL_BLEND);
|
||||
}
|
||||
stateGlobalBlend = true;
|
||||
}
|
||||
|
||||
public static final void blendFunc(int srcFactor, int dstFactor) {
|
||||
public static void blendFunc(int srcFactor, int dstFactor) {
|
||||
if(stateEnableOverlayFramebufferBlending) {
|
||||
tryBlendFuncSeparate(srcFactor, dstFactor, 0, 1);
|
||||
return;
|
||||
@ -419,7 +419,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void tryBlendFuncSeparate(int srcFactor, int dstFactor, int srcFactorAlpha, int dstFactorAlpha) {
|
||||
public static void tryBlendFuncSeparate(int srcFactor, int dstFactor, int srcFactorAlpha, int dstFactorAlpha) {
|
||||
if(stateEnableOverlayFramebufferBlending) { // game overlay framebuffer in EntityRenderer.java
|
||||
srcFactorAlpha = GL_ONE;
|
||||
dstFactorAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
||||
@ -433,15 +433,15 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void enableOverlayFramebufferBlending() {
|
||||
public static void enableOverlayFramebufferBlending() {
|
||||
stateEnableOverlayFramebufferBlending = true;
|
||||
}
|
||||
|
||||
public static final void disableOverlayFramebufferBlending() {
|
||||
public static void disableOverlayFramebufferBlending() {
|
||||
stateEnableOverlayFramebufferBlending = false;
|
||||
}
|
||||
|
||||
public static final void setShaderBlendSrc(float r, float g, float b, float a) {
|
||||
public static void setShaderBlendSrc(float r, float g, float b, float a) {
|
||||
stateShaderBlendSrcColorR = r;
|
||||
stateShaderBlendSrcColorG = g;
|
||||
stateShaderBlendSrcColorB = b;
|
||||
@ -449,7 +449,7 @@ public class GlStateManager {
|
||||
++stateShaderBlendColorSerial;
|
||||
}
|
||||
|
||||
public static final void setShaderBlendAdd(float r, float g, float b, float a) {
|
||||
public static void setShaderBlendAdd(float r, float g, float b, float a) {
|
||||
stateShaderBlendAddColorR = r;
|
||||
stateShaderBlendAddColorG = g;
|
||||
stateShaderBlendAddColorB = b;
|
||||
@ -457,15 +457,15 @@ public class GlStateManager {
|
||||
++stateShaderBlendColorSerial;
|
||||
}
|
||||
|
||||
public static final void enableShaderBlendAdd() {
|
||||
public static void enableShaderBlendAdd() {
|
||||
stateEnableShaderBlendColor = true;
|
||||
}
|
||||
|
||||
public static final void disableShaderBlendAdd() {
|
||||
public static void disableShaderBlendAdd() {
|
||||
stateEnableShaderBlendColor = false;
|
||||
}
|
||||
|
||||
public static final void setBlendConstants(float r, float g, float b, float a) {
|
||||
public static void setBlendConstants(float r, float g, float b, float a) {
|
||||
if(r != blendConstantR || g != blendConstantG || b != blendConstantB || a != blendConstantA) {
|
||||
_wglBlendColor(r, g, b, a);
|
||||
blendConstantR = r;
|
||||
@ -475,70 +475,70 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void enableFog() {
|
||||
public static void enableFog() {
|
||||
stateFog = true;
|
||||
}
|
||||
|
||||
public static final void disableFog() {
|
||||
public static void disableFog() {
|
||||
stateFog = false;
|
||||
}
|
||||
|
||||
public static final void setFog(int param) {
|
||||
public static void setFog(int param) {
|
||||
stateFogEXP = param == GL_EXP;
|
||||
++stateFogSerial;
|
||||
}
|
||||
|
||||
public static final void setFogDensity(float param) {
|
||||
public static void setFogDensity(float param) {
|
||||
stateFogDensity = param;
|
||||
++stateFogSerial;
|
||||
}
|
||||
|
||||
public static final void setFogStart(float param) {
|
||||
public static void setFogStart(float param) {
|
||||
stateFogStart = param;
|
||||
++stateFogSerial;
|
||||
}
|
||||
|
||||
public static final void setFogEnd(float param) {
|
||||
public static void setFogEnd(float param) {
|
||||
stateFogEnd = param;
|
||||
++stateFogSerial;
|
||||
}
|
||||
|
||||
public static final void enableCull() {
|
||||
public static void enableCull() {
|
||||
if(!stateCull) {
|
||||
_wglEnable(GL_CULL_FACE);
|
||||
stateCull = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void disableCull() {
|
||||
public static void disableCull() {
|
||||
if(stateCull) {
|
||||
_wglDisable(GL_CULL_FACE);
|
||||
stateCull = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void cullFace(int mode) {
|
||||
public static void cullFace(int mode) {
|
||||
if(stateCullFace != mode) {
|
||||
_wglCullFace(mode);
|
||||
stateCullFace = mode;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void enablePolygonOffset() {
|
||||
public static void enablePolygonOffset() {
|
||||
if(!statePolygonOffset) {
|
||||
_wglEnable(GL_POLYGON_OFFSET_FILL);
|
||||
statePolygonOffset = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void disablePolygonOffset() {
|
||||
public static void disablePolygonOffset() {
|
||||
if(statePolygonOffset) {
|
||||
_wglDisable(GL_POLYGON_OFFSET_FILL);
|
||||
statePolygonOffset = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void doPolygonOffset(float factor, float units) {
|
||||
public static void doPolygonOffset(float factor, float units) {
|
||||
if(factor != statePolygonOffsetFactor || units != statePolygonOffsetUnits) {
|
||||
_wglPolygonOffset(-factor, units);
|
||||
statePolygonOffsetFactor = factor;
|
||||
@ -546,32 +546,32 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void enableColorLogic() {
|
||||
public static void enableColorLogic() {
|
||||
throw new UnsupportedOperationException("Color logic op is not supported in OpenGL ES!");
|
||||
}
|
||||
|
||||
public static final void disableColorLogic() {
|
||||
public static void disableColorLogic() {
|
||||
|
||||
}
|
||||
|
||||
public static final void colorLogicOp(int opcode) {
|
||||
public static void colorLogicOp(int opcode) {
|
||||
|
||||
}
|
||||
|
||||
public static final void enableTexGen() {
|
||||
public static void enableTexGen() {
|
||||
stateTexGen = true;
|
||||
}
|
||||
|
||||
public static final void disableTexGen() {
|
||||
public static void disableTexGen() {
|
||||
stateTexGen = false;
|
||||
}
|
||||
|
||||
public static final void texGen(GlStateManager.TexGen coord, int source) {
|
||||
public static void texGen(GlStateManager.TexGen coord, int source) {
|
||||
coord.source = source;
|
||||
++stateTexGenSerial;
|
||||
}
|
||||
|
||||
public static final void func_179105_a(GlStateManager.TexGen coord, int plane, FloatBuffer vector) {
|
||||
public static void func_179105_a(GlStateManager.TexGen coord, int plane, FloatBuffer vector) {
|
||||
coord.plane = plane;
|
||||
coord.vector.load(vector);
|
||||
if(plane == GL_EYE_PLANE) {
|
||||
@ -581,7 +581,7 @@ public class GlStateManager {
|
||||
++stateTexGenSerial;
|
||||
}
|
||||
|
||||
public static final void setActiveTexture(int texture) {
|
||||
public static void setActiveTexture(int texture) {
|
||||
int textureIdx = texture - GL_TEXTURE0;
|
||||
if(textureIdx != activeTexture) {
|
||||
_wglActiveTexture(texture);
|
||||
@ -589,44 +589,44 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void enableTexture2D() {
|
||||
public static void enableTexture2D() {
|
||||
stateTexture[activeTexture] = true;
|
||||
}
|
||||
|
||||
public static final void disableTexture2D() {
|
||||
public static void disableTexture2D() {
|
||||
stateTexture[activeTexture] = false;
|
||||
}
|
||||
|
||||
public static final void texCoords2D(float x, float y) {
|
||||
public static void texCoords2D(float x, float y) {
|
||||
textureCoordsX[activeTexture] = x;
|
||||
textureCoordsY[activeTexture] = y;
|
||||
++textureCoordsAccessSerial[activeTexture];
|
||||
}
|
||||
|
||||
public static final void texCoords2DDirect(int tex, float x, float y) {
|
||||
public static void texCoords2DDirect(int tex, float x, float y) {
|
||||
textureCoordsX[tex] = x;
|
||||
textureCoordsY[tex] = y;
|
||||
++textureCoordsAccessSerial[tex];
|
||||
}
|
||||
|
||||
public static final float getTexCoordX(int tex) {
|
||||
public static float getTexCoordX(int tex) {
|
||||
return textureCoordsX[tex];
|
||||
}
|
||||
|
||||
public static final float getTexCoordY(int tex) {
|
||||
public static float getTexCoordY(int tex) {
|
||||
return textureCoordsY[tex];
|
||||
}
|
||||
|
||||
public static final int generateTexture() {
|
||||
public static int generateTexture() {
|
||||
return EaglercraftGPU.mapTexturesGL.register(_wglGenTextures());
|
||||
}
|
||||
|
||||
public static final void deleteTexture(int texture) {
|
||||
public static void deleteTexture(int texture) {
|
||||
unbindTextureIfCached(texture);
|
||||
_wglDeleteTextures(EaglercraftGPU.mapTexturesGL.free(texture));
|
||||
}
|
||||
|
||||
static final void unbindTextureIfCached(int texture) {
|
||||
static void unbindTextureIfCached(int texture) {
|
||||
boolean f1, f2 = false;
|
||||
for(int i = 0; i < boundTexture.length; ++i) {
|
||||
if(boundTexture[i] == texture) {
|
||||
@ -647,21 +647,21 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void bindTexture(int texture) {
|
||||
public static void bindTexture(int texture) {
|
||||
if(texture != boundTexture[activeTexture]) {
|
||||
_wglBindTexture(GL_TEXTURE_2D, EaglercraftGPU.mapTexturesGL.get(texture));
|
||||
boundTexture[activeTexture] = texture;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void bindTexture3D(int texture) {
|
||||
public static void bindTexture3D(int texture) {
|
||||
if(texture != boundTexture[activeTexture]) {
|
||||
_wglBindTexture(GL_TEXTURE_3D, EaglercraftGPU.mapTexturesGL.get(texture));
|
||||
boundTexture[activeTexture] = texture;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void quickBindTexture(int unit, int texture) {
|
||||
public static void quickBindTexture(int unit, int texture) {
|
||||
int unitBase = unit - GL_TEXTURE0;
|
||||
if(texture != boundTexture[unitBase]) {
|
||||
if(unitBase != activeTexture) {
|
||||
@ -675,19 +675,19 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void shadeModel(int mode) {
|
||||
public static void shadeModel(int mode) {
|
||||
|
||||
}
|
||||
|
||||
public static final void enableRescaleNormal() {
|
||||
public static void enableRescaleNormal() {
|
||||
// still not sure what this is for
|
||||
}
|
||||
|
||||
public static final void disableRescaleNormal() {
|
||||
public static void disableRescaleNormal() {
|
||||
|
||||
}
|
||||
|
||||
public static final void viewport(int x, int y, int w, int h) {
|
||||
public static void viewport(int x, int y, int w, int h) {
|
||||
if(viewportX != x || viewportY != y || viewportW != w || viewportH != h) {
|
||||
_wglViewport(x, y, w, h);
|
||||
viewportX = x;
|
||||
@ -697,7 +697,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void colorMask(boolean red, boolean green, boolean blue, boolean alpha) {
|
||||
public static void colorMask(boolean red, boolean green, boolean blue, boolean alpha) {
|
||||
int bits = (red ? 1 : 0) | (green ? 2 : 0) | (blue ? 4 : 0) | (alpha ? 8 : 0);
|
||||
if(bits != colorMaskBits) {
|
||||
_wglColorMask(red, green, blue, alpha);
|
||||
@ -705,7 +705,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void clearDepth(float depth) {
|
||||
public static void clearDepth(float depth) {
|
||||
depth = 1.0f - depth;
|
||||
if(depth != clearDepth) {
|
||||
_wglClearDepth(depth);
|
||||
@ -713,7 +713,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void clearColor(float red, float green, float blue, float alpha) {
|
||||
public static void clearColor(float red, float green, float blue, float alpha) {
|
||||
if(red != clearColorR || green != clearColorG || blue != clearColorB || alpha != clearColorA) {
|
||||
_wglClearColor(red, green, blue, alpha);
|
||||
clearColorR = red;
|
||||
@ -723,15 +723,15 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void clear(int mask) {
|
||||
public static void clear(int mask) {
|
||||
_wglClear(mask);
|
||||
}
|
||||
|
||||
public static final void matrixMode(int mode) {
|
||||
public static void matrixMode(int mode) {
|
||||
stateMatrixMode = mode;
|
||||
}
|
||||
|
||||
public static final void loadIdentity() {
|
||||
public static void loadIdentity() {
|
||||
switch(stateMatrixMode) {
|
||||
case GL_MODELVIEW:
|
||||
default:
|
||||
@ -750,7 +750,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void pushMatrix() {
|
||||
public static void pushMatrix() {
|
||||
int push;
|
||||
switch(stateMatrixMode) {
|
||||
case GL_MODELVIEW:
|
||||
@ -794,7 +794,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void popMatrix() {
|
||||
public static void popMatrix() {
|
||||
switch(stateMatrixMode) {
|
||||
case GL_MODELVIEW:
|
||||
default:
|
||||
@ -853,7 +853,7 @@ public class GlStateManager {
|
||||
return mat;
|
||||
}
|
||||
|
||||
public static final void getFloat(int pname, float[] params) {
|
||||
public static void getFloat(int pname, float[] params) {
|
||||
switch(pname) {
|
||||
case GL_MODELVIEW_MATRIX:
|
||||
modelMatrixStack[modelMatrixStackPointer].store(params);
|
||||
@ -869,7 +869,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void getFloat(int pname, FloatBuffer params) {
|
||||
public static void getFloat(int pname, FloatBuffer params) {
|
||||
switch(pname) {
|
||||
case GL_MODELVIEW_MATRIX:
|
||||
modelMatrixStack[modelMatrixStackPointer].store(params);
|
||||
@ -885,7 +885,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void ortho(double left, double right, double bottom, double top, double zNear, double zFar) {
|
||||
public static void ortho(double left, double right, double bottom, double top, double zNear, double zFar) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
paramMatrix.m00 = 2.0f / (float)(right - left);
|
||||
paramMatrix.m01 = 0.0f;
|
||||
@ -908,7 +908,7 @@ public class GlStateManager {
|
||||
|
||||
private static final Vector3f paramVector = new Vector3f();
|
||||
private static final float toRad = 0.0174532925f;
|
||||
public static final void rotate(float angle, float x, float y, float z) {
|
||||
public static void rotate(float angle, float x, float y, float z) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
if(x == 0.0f) {
|
||||
if(y == 0.0f) {
|
||||
@ -927,28 +927,28 @@ public class GlStateManager {
|
||||
_glRotatef(matrix, toRad * angle, x, y, z);
|
||||
}
|
||||
|
||||
public static final void rotateXYZ(float x, float y, float z) {
|
||||
public static void rotateXYZ(float x, float y, float z) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
if(x != 0.0f) _glRotatefX(matrix, toRad * x);
|
||||
if(y != 0.0f) _glRotatefY(matrix, toRad * y);
|
||||
if(z != 0.0f) _glRotatefZ(matrix, toRad * z);
|
||||
}
|
||||
|
||||
public static final void rotateZYX(float x, float y, float z) {
|
||||
public static void rotateZYX(float x, float y, float z) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
if(z != 0.0f) _glRotatefZ(matrix, toRad * z);
|
||||
if(y != 0.0f) _glRotatefY(matrix, toRad * y);
|
||||
if(x != 0.0f) _glRotatefX(matrix, toRad * x);
|
||||
}
|
||||
|
||||
public static final void rotateXYZRad(float x, float y, float z) {
|
||||
public static void rotateXYZRad(float x, float y, float z) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
if(x != 0.0f) _glRotatefX(matrix, x);
|
||||
if(y != 0.0f) _glRotatefY(matrix, y);
|
||||
if(z != 0.0f) _glRotatefZ(matrix, z);
|
||||
}
|
||||
|
||||
public static final void rotateZYXRad(float x, float y, float z) {
|
||||
public static void rotateZYXRad(float x, float y, float z) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
if(z != 0.0f) _glRotatefZ(matrix, z);
|
||||
if(y != 0.0f) _glRotatefY(matrix, y);
|
||||
@ -1042,7 +1042,7 @@ public class GlStateManager {
|
||||
mat.m13 = nm13;
|
||||
}
|
||||
|
||||
public static final void scale(float x, float y, float z) {
|
||||
public static void scale(float x, float y, float z) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
matrix.m00 *= x;
|
||||
matrix.m01 *= x;
|
||||
@ -1058,7 +1058,7 @@ public class GlStateManager {
|
||||
matrix.m23 *= z;
|
||||
}
|
||||
|
||||
public static final void scale(double x, double y, double z) {
|
||||
public static void scale(double x, double y, double z) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
matrix.m00 *= x;
|
||||
matrix.m01 *= x;
|
||||
@ -1074,7 +1074,7 @@ public class GlStateManager {
|
||||
matrix.m23 *= z;
|
||||
}
|
||||
|
||||
public static final void translate(float x, float y, float z) {
|
||||
public static void translate(float x, float y, float z) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
matrix.m30 = matrix.m00 * x + matrix.m10 * y + matrix.m20 * z + matrix.m30;
|
||||
matrix.m31 = matrix.m01 * x + matrix.m11 * y + matrix.m21 * z + matrix.m31;
|
||||
@ -1082,7 +1082,7 @@ public class GlStateManager {
|
||||
matrix.m33 = matrix.m03 * x + matrix.m13 * y + matrix.m23 * z + matrix.m33;
|
||||
}
|
||||
|
||||
public static final void translate(double x, double y, double z) {
|
||||
public static void translate(double x, double y, double z) {
|
||||
float _x = (float)x;
|
||||
float _y = (float)y;
|
||||
float _z = (float)z;
|
||||
@ -1094,18 +1094,18 @@ public class GlStateManager {
|
||||
}
|
||||
|
||||
private static final Matrix4f paramMatrix = new Matrix4f();
|
||||
public static final void multMatrix(float[] matrix) {
|
||||
public static void multMatrix(float[] matrix) {
|
||||
paramMatrix.load(matrix);
|
||||
Matrix4f mat = getMatrixIncr();
|
||||
Matrix4f.mul(mat, paramMatrix, mat);
|
||||
}
|
||||
|
||||
public static final void multMatrix(Matrix4f matrix) {
|
||||
public static void multMatrix(Matrix4f matrix) {
|
||||
Matrix4f mat = getMatrixIncr();
|
||||
Matrix4f.mul(mat, matrix, mat);
|
||||
}
|
||||
|
||||
public static final void color(float colorRed, float colorGreen, float colorBlue, float colorAlpha) {
|
||||
public static void color(float colorRed, float colorGreen, float colorBlue, float colorAlpha) {
|
||||
stateColorR = colorRed;
|
||||
stateColorG = colorGreen;
|
||||
stateColorB = colorBlue;
|
||||
@ -1113,7 +1113,7 @@ public class GlStateManager {
|
||||
++stateColorSerial;
|
||||
}
|
||||
|
||||
public static final void color(float colorRed, float colorGreen, float colorBlue) {
|
||||
public static void color(float colorRed, float colorGreen, float colorBlue) {
|
||||
stateColorR = colorRed;
|
||||
stateColorG = colorGreen;
|
||||
stateColorB = colorBlue;
|
||||
@ -1121,7 +1121,7 @@ public class GlStateManager {
|
||||
++stateColorSerial;
|
||||
}
|
||||
|
||||
public static final void resetColor() {
|
||||
public static void resetColor() {
|
||||
stateColorR = 1.0f;
|
||||
stateColorG = 1.0f;
|
||||
stateColorB = 1.0f;
|
||||
@ -1129,11 +1129,11 @@ public class GlStateManager {
|
||||
++stateColorSerial;
|
||||
}
|
||||
|
||||
public static final void callList(int list) {
|
||||
public static void callList(int list) {
|
||||
EaglercraftGPU.glCallList(list);
|
||||
}
|
||||
|
||||
public static final void gluPerspective(float fovy, float aspect, float zNear, float zFar) {
|
||||
public static void gluPerspective(float fovy, float aspect, float zNear, float zFar) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
float cotangent = (float) Math.cos(fovy * toRad * 0.5f) / (float) Math.sin(fovy * toRad * 0.5f);
|
||||
paramMatrix.m00 = cotangent / aspect;
|
||||
@ -1155,7 +1155,7 @@ public class GlStateManager {
|
||||
Matrix4f.mul(matrix, paramMatrix, matrix);
|
||||
}
|
||||
|
||||
public static final void gluLookAt(Vector3f eye, Vector3f center, Vector3f up) {
|
||||
public static void gluLookAt(Vector3f eye, Vector3f center, Vector3f up) {
|
||||
Matrix4f matrix = getMatrixIncr();
|
||||
float x = center.x - eye.x;
|
||||
float y = center.y - eye.y;
|
||||
@ -1196,7 +1196,7 @@ public class GlStateManager {
|
||||
Matrix4f.mul(matrix, paramMatrix, matrix);
|
||||
}
|
||||
|
||||
public static final void transform(Vector4f vecIn, Vector4f vecOut) {
|
||||
public static void transform(Vector4f vecIn, Vector4f vecOut) {
|
||||
Matrix4f matrix;
|
||||
switch(stateMatrixMode) {
|
||||
case GL_MODELVIEW:
|
||||
@ -1216,7 +1216,7 @@ public class GlStateManager {
|
||||
private static final Matrix4f unprojA = new Matrix4f();
|
||||
private static final Matrix4f unprojB = new Matrix4f();
|
||||
private static final Vector4f unprojC = new Vector4f();
|
||||
public static final void gluUnProject(float p1, float p2, float p3, float[] modelview, float[] projection,
|
||||
public static void gluUnProject(float p1, float p2, float p3, float[] modelview, float[] projection,
|
||||
int[] viewport, float[] objectcoords) {
|
||||
unprojA.load(modelview);
|
||||
unprojB.load(projection);
|
||||
@ -1230,7 +1230,7 @@ public class GlStateManager {
|
||||
objectcoords[2] = unprojC.z / unprojC.w;
|
||||
}
|
||||
|
||||
public static final void getMatrix(Matrix4f mat) {
|
||||
public static void getMatrix(Matrix4f mat) {
|
||||
switch(stateMatrixMode) {
|
||||
case GL_MODELVIEW:
|
||||
mat.load(modelMatrixStack[modelMatrixStackPointer]);
|
||||
@ -1245,7 +1245,7 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void loadMatrix(Matrix4f mat) {
|
||||
public static void loadMatrix(Matrix4f mat) {
|
||||
switch(stateMatrixMode) {
|
||||
case GL_MODELVIEW:
|
||||
modelMatrixStack[modelMatrixStackPointer].load(mat);
|
||||
@ -1263,15 +1263,15 @@ public class GlStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final int getModelViewSerial() {
|
||||
public static int getModelViewSerial() {
|
||||
return modelMatrixStackAccessSerial[modelMatrixStackPointer];
|
||||
}
|
||||
|
||||
public static final Matrix4f getModelViewReference() {
|
||||
public static Matrix4f getModelViewReference() {
|
||||
return modelMatrixStack[modelMatrixStackPointer];
|
||||
}
|
||||
|
||||
public static final Matrix4f getProjectionReference() {
|
||||
public static Matrix4f getProjectionReference() {
|
||||
return projectionMatrixStack[projectionMatrixStackPointer];
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.opengl;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunctionState;
|
||||
|
||||
public class HighPolyMesh {
|
||||
|
||||
IBufferArrayGL vertexArray;
|
||||
IVertexArrayGL vertexArray;
|
||||
IBufferGL vertexBuffer;
|
||||
IBufferGL indexBuffer;
|
||||
|
||||
@ -31,7 +31,7 @@ public class HighPolyMesh {
|
||||
|
||||
boolean hasTexture;
|
||||
|
||||
public HighPolyMesh(IBufferArrayGL vertexArray, IBufferGL vertexBuffer, IBufferGL indexBuffer, int vertexCount,
|
||||
public HighPolyMesh(IVertexArrayGL vertexArray, IBufferGL vertexBuffer, IBufferGL indexBuffer, int vertexCount,
|
||||
int indexCount, boolean hasTexture) {
|
||||
this.vertexArray = vertexArray;
|
||||
this.vertexBuffer = vertexBuffer;
|
||||
|
@ -20,7 +20,7 @@ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
||||
@ -54,7 +54,7 @@ public class InstancedFontRenderer {
|
||||
private static IUniformGL u_color4f = null;
|
||||
private static IUniformGL u_colorBias4f = null;
|
||||
|
||||
private static IBufferArrayGL vertexArray = null;
|
||||
private static IVertexArrayGL vertexArray = null;
|
||||
private static IBufferGL vertexBuffer = null;
|
||||
|
||||
private static IBufferGL instancesBuffer = null;
|
||||
@ -160,7 +160,7 @@ public class InstancedFontRenderer {
|
||||
|
||||
_wglUniform1i(_wglGetUniformLocation(shaderProgram, "u_inputTexture"), 0);
|
||||
|
||||
vertexArray = EaglercraftGPU.createGLBufferArray();
|
||||
vertexArray = EaglercraftGPU.createGLVertexArray();
|
||||
vertexBuffer = _wglGenBuffers();
|
||||
instancesBuffer = _wglGenBuffers();
|
||||
|
||||
@ -191,7 +191,7 @@ public class InstancedFontRenderer {
|
||||
});
|
||||
verts.flip();
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
EaglercraftGPU.bindVAOGLArrayBufferNow(vertexBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
|
||||
@ -370,7 +370,7 @@ public class InstancedFontRenderer {
|
||||
}
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
if(charactersDrawn > 0) {
|
||||
int p = fontDataBuffer.position();
|
||||
@ -382,7 +382,7 @@ public class InstancedFontRenderer {
|
||||
fontDataBuffer.position(p);
|
||||
fontDataBuffer.limit(l);
|
||||
|
||||
EaglercraftGPU.doDrawArraysInstanced(GL_TRIANGLES, shadow ? 0 : 6, shadow ? 12 : 6, charactersDrawn);
|
||||
EaglercraftGPU.drawArraysInstanced(GL_TRIANGLES, shadow ? 0 : 6, shadow ? 12 : 6, charactersDrawn);
|
||||
}
|
||||
|
||||
if(boldCharactersDrawn > 0) {
|
||||
@ -395,7 +395,7 @@ public class InstancedFontRenderer {
|
||||
fontBoldDataBuffer.position(p);
|
||||
fontBoldDataBuffer.limit(l);
|
||||
|
||||
EaglercraftGPU.doDrawArraysInstanced(GL_TRIANGLES, shadow ? 12 : 24, shadow ? 24 : 12, boldCharactersDrawn);
|
||||
EaglercraftGPU.drawArraysInstanced(GL_TRIANGLES, shadow ? 12 : 24, shadow ? 24 : 12, boldCharactersDrawn);
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ public class InstancedFontRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
private static final void updateBounds(int x, int y) {
|
||||
private static void updateBounds(int x, int y) {
|
||||
if(x < widthCalcLeast || widthCalcLeast == Integer.MAX_VALUE) widthCalcLeast = x;
|
||||
if(x > widthCalcMost || widthCalcMost == Integer.MAX_VALUE) widthCalcMost = x;
|
||||
if(y < heightCalcLeast || heightCalcLeast == Integer.MAX_VALUE) heightCalcLeast = y;
|
||||
@ -479,7 +479,7 @@ public class InstancedFontRenderer {
|
||||
u_color4f = null;
|
||||
u_colorBias4f = null;
|
||||
if(vertexArray != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.destroyGLVertexArray(vertexArray);
|
||||
vertexArray = null;
|
||||
}
|
||||
if(vertexBuffer != null) {
|
||||
|
@ -20,7 +20,7 @@ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
||||
@ -56,7 +56,7 @@ public class InstancedParticleRenderer {
|
||||
private static IUniformGL u_transformParam_3_4_f = null;
|
||||
private static IUniformGL u_color4f = null;
|
||||
|
||||
private static IBufferArrayGL vertexArray = null;
|
||||
private static IVertexArrayGL vertexArray = null;
|
||||
private static IBufferGL vertexBuffer = null;
|
||||
|
||||
private static IBufferGL instancesBuffer = null;
|
||||
@ -161,7 +161,7 @@ public class InstancedParticleRenderer {
|
||||
_wglUniform1i(_wglGetUniformLocation(shaderProgram, "u_inputTexture"), 0);
|
||||
_wglUniform1i(_wglGetUniformLocation(shaderProgram, "u_lightmapTexture"), 1);
|
||||
|
||||
vertexArray = EaglercraftGPU.createGLBufferArray();
|
||||
vertexArray = EaglercraftGPU.createGLVertexArray();
|
||||
vertexBuffer = _wglGenBuffers();
|
||||
instancesBuffer = _wglGenBuffers();
|
||||
|
||||
@ -172,7 +172,7 @@ public class InstancedParticleRenderer {
|
||||
});
|
||||
verts.flip();
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
EaglercraftGPU.bindVAOGLArrayBufferNow(vertexBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
|
||||
@ -305,7 +305,7 @@ public class InstancedParticleRenderer {
|
||||
}
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
int p = particleBuffer.position();
|
||||
int l = particleBuffer.limit();
|
||||
@ -316,7 +316,7 @@ public class InstancedParticleRenderer {
|
||||
particleBuffer.position(p);
|
||||
particleBuffer.limit(l);
|
||||
|
||||
EaglercraftGPU.doDrawArraysInstanced(GL_TRIANGLES, 0, 6, particleCount);
|
||||
EaglercraftGPU.drawArraysInstanced(GL_TRIANGLES, 0, 6, particleCount);
|
||||
}
|
||||
|
||||
public static void stupidColorSetHack(IUniformGL color4f) {
|
||||
@ -342,7 +342,7 @@ public class InstancedParticleRenderer {
|
||||
u_transformParam_3_4_f = null;
|
||||
u_color4f = null;
|
||||
if(vertexArray != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.destroyGLVertexArray(vertexArray);
|
||||
vertexArray = null;
|
||||
}
|
||||
if(vertexBuffer != null) {
|
||||
|
@ -16,12 +16,12 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.opengl;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
|
||||
class SoftGLBufferArray implements IBufferArrayGL {
|
||||
class SoftGLVertexArray implements IVertexArrayGL {
|
||||
|
||||
Attrib[] attribs = new Attrib[4];
|
||||
int[] attribDivisors = null;
|
||||
@ -30,7 +30,7 @@ class SoftGLBufferArray implements IBufferArrayGL {
|
||||
int enabledCnt = -1;
|
||||
IBufferGL indexBuffer = null;
|
||||
|
||||
SoftGLBufferArray() {
|
||||
SoftGLVertexArray() {
|
||||
}
|
||||
|
||||
void setAttrib(IBufferGL buffer, int index, int size, int format, boolean normalized, int stride, int offset) {
|
||||
@ -87,7 +87,7 @@ class SoftGLBufferArray implements IBufferArrayGL {
|
||||
indexBuffer = buffer;
|
||||
}
|
||||
|
||||
void transitionToState(SoftGLBufferState previousState, boolean elements) {
|
||||
void transitionToState(SoftGLVertexState previousState, boolean elements) {
|
||||
int oldEnabled = previousState.oldEnabled;
|
||||
int oldEnabledCnt = previousState.oldEnabledCnt;
|
||||
int[] oldAttribDivisors = previousState.attribDivisors;
|
@ -16,9 +16,9 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.opengl;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.SoftGLBufferArray.Attrib;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.SoftGLVertexArray.Attrib;
|
||||
|
||||
class SoftGLBufferState {
|
||||
class SoftGLVertexState {
|
||||
|
||||
final Attrib[] attribs = new Attrib[24];
|
||||
int[] attribDivisors = new int[24];
|
||||
@ -26,7 +26,7 @@ class SoftGLBufferState {
|
||||
int oldEnabled = 0;
|
||||
int oldEnabledCnt = -1;
|
||||
|
||||
SoftGLBufferState() {
|
||||
SoftGLVertexState() {
|
||||
}
|
||||
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.opengl;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
@ -76,12 +76,12 @@ public class StreamBuffer {
|
||||
public static class StreamBufferInstance {
|
||||
|
||||
protected PoolInstance poolInstance = null;
|
||||
protected IBufferArrayGL vertexArray = null;
|
||||
protected IVertexArrayGL vertexArray = null;
|
||||
|
||||
public boolean bindQuad16 = false;
|
||||
public boolean bindQuad32 = false;
|
||||
|
||||
public IBufferArrayGL getVertexArray() {
|
||||
public IVertexArrayGL getVertexArray() {
|
||||
return vertexArray;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ public class StreamBuffer {
|
||||
}
|
||||
|
||||
public static interface IStreamBufferInitializer {
|
||||
void initialize(IBufferArrayGL vertexArray, IBufferGL vertexBuffer);
|
||||
void initialize(IVertexArrayGL vertexArray, IBufferGL vertexBuffer);
|
||||
}
|
||||
|
||||
public StreamBuffer(int initialSize, int initialCount, int maxCount, IStreamBufferInitializer initializer) {
|
||||
@ -115,7 +115,7 @@ public class StreamBuffer {
|
||||
StreamBufferInstance next = buffers[(currentBufferId++) % buffers.length];
|
||||
resizeInstance(next.poolInstance, requiredMemory);
|
||||
if(next.vertexArray == null) {
|
||||
next.vertexArray = EaglercraftGPU.createGLBufferArray();
|
||||
next.vertexArray = EaglercraftGPU.createGLVertexArray();
|
||||
initializer.initialize(next.vertexArray, next.poolInstance.vertexBuffer);
|
||||
}
|
||||
return next;
|
||||
@ -135,7 +135,7 @@ public class StreamBuffer {
|
||||
newArray[i] = buffers[i];
|
||||
}else {
|
||||
if(buffers[i].vertexArray != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(buffers[i].vertexArray);
|
||||
EaglercraftGPU.destroyGLVertexArray(buffers[i].vertexArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@ public class StreamBuffer {
|
||||
for(int i = 0; i < buffers.length; ++i) {
|
||||
StreamBufferInstance next = buffers[i];
|
||||
if(next.vertexArray != null) {
|
||||
EaglercraftGPU.destroyGLBufferArray(next.vertexArray);
|
||||
EaglercraftGPU.destroyGLVertexArray(next.vertexArray);
|
||||
}
|
||||
}
|
||||
buffers = new StreamBufferInstance[initialCount];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 lax1dude. All Rights Reserved.
|
||||
* Copyright (c) 2022-2025 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
@ -19,6 +19,7 @@ package net.lax1dude.eaglercraft.v1_8.opengl;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
|
||||
public class WorldVertexBufferUploader {
|
||||
|
||||
public static void func_181679_a(WorldRenderer parWorldRenderer) {
|
||||
int cunt = parWorldRenderer.getVertexCount();
|
||||
if (cunt > 0) {
|
||||
@ -30,4 +31,18 @@ public class WorldVertexBufferUploader {
|
||||
parWorldRenderer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
public static void uploadDisplayList(int displayList, WorldRenderer worldRenderer) {
|
||||
int cunt = worldRenderer.getVertexCount();
|
||||
if (cunt > 0) {
|
||||
VertexFormat fmt = worldRenderer.getVertexFormat();
|
||||
ByteBuffer buf = worldRenderer.getByteBuffer();
|
||||
buf.position(0).limit(cunt * fmt.attribStride);
|
||||
EaglercraftGPU.uploadListDirect(displayList, buf, fmt.eaglercraftAttribBits, worldRenderer.getDrawMode(), cunt);
|
||||
worldRenderer.reset();
|
||||
}else {
|
||||
EaglercraftGPU.flushDisplayList(displayList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -83,7 +83,7 @@ public class DebugFramebufferView {
|
||||
(new DebugFramebufferView("Sun Shadow Depth: LOD 1", (pipeline) -> {
|
||||
if(pipeline.config.is_rendering_shadowsSun_clamped < 1) throw new NoDataException();
|
||||
PipelineShaderGBufferDebugView dbv = pipeline.useDebugViewShader(5);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / pipeline.config.is_rendering_shadowsSun_clamped, 0.0f);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / Math.min(pipeline.config.is_rendering_shadowsSun_clamped, 3), 0.0f);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
GlStateManager.bindTexture(pipeline.sunShadowDepthBuffer);
|
||||
_wglTexParameteri(GL_TEXTURE_2D, _GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
@ -93,7 +93,7 @@ public class DebugFramebufferView {
|
||||
(new DebugFramebufferView("Sun Shadow Color: LOD 1", (pipeline) -> {
|
||||
if(pipeline.config.is_rendering_shadowsSun_clamped < 1 || !pipeline.config.is_rendering_shadowsColored) throw new NoDataException();
|
||||
PipelineShaderGBufferDebugView dbv = pipeline.useDebugViewShader(10);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / pipeline.config.is_rendering_shadowsSun_clamped, 0.0f);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / Math.min(pipeline.config.is_rendering_shadowsSun_clamped, 3), 0.0f);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE1);
|
||||
GlStateManager.bindTexture(pipeline.sunShadowColorBuffer);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
@ -105,7 +105,7 @@ public class DebugFramebufferView {
|
||||
(new DebugFramebufferView("Sun Shadow Depth: LOD 2", (pipeline) -> {
|
||||
if(pipeline.config.is_rendering_shadowsSun_clamped < 2) throw new NoDataException();
|
||||
PipelineShaderGBufferDebugView dbv = pipeline.useDebugViewShader(5);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / pipeline.config.is_rendering_shadowsSun_clamped, 1.0f);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / Math.min(pipeline.config.is_rendering_shadowsSun_clamped, 3), 1.0f);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
GlStateManager.bindTexture(pipeline.sunShadowDepthBuffer);
|
||||
_wglTexParameteri(GL_TEXTURE_2D, _GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
@ -115,7 +115,7 @@ public class DebugFramebufferView {
|
||||
(new DebugFramebufferView("Sun Shadow Color: LOD 2", (pipeline) -> {
|
||||
if(pipeline.config.is_rendering_shadowsSun_clamped < 2 || !pipeline.config.is_rendering_shadowsColored) throw new NoDataException();
|
||||
PipelineShaderGBufferDebugView dbv = pipeline.useDebugViewShader(10);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / pipeline.config.is_rendering_shadowsSun_clamped, 1.0f);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / Math.min(pipeline.config.is_rendering_shadowsSun_clamped, 3), 1.0f);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE1);
|
||||
GlStateManager.bindTexture(pipeline.sunShadowColorBuffer);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
@ -127,7 +127,7 @@ public class DebugFramebufferView {
|
||||
(new DebugFramebufferView("Sun Shadow Depth: LOD 3", (pipeline) -> {
|
||||
if(pipeline.config.is_rendering_shadowsSun_clamped < 3) throw new NoDataException();
|
||||
PipelineShaderGBufferDebugView dbv = pipeline.useDebugViewShader(5);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / pipeline.config.is_rendering_shadowsSun_clamped, 2.0f);
|
||||
_wglUniform2f(dbv.uniforms.u_depthSliceStartEnd2f, 1.0f / Math.min(pipeline.config.is_rendering_shadowsSun_clamped, 3), 2.0f);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
GlStateManager.bindTexture(pipeline.sunShadowDepthBuffer);
|
||||
_wglTexParameteri(GL_TEXTURE_2D, _GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
@ -145,6 +145,13 @@ public class DebugFramebufferView {
|
||||
GlStateManager.bindTexture(pipeline.sunLightingShadowTexture);
|
||||
DrawUtils.drawStandardQuad2D();
|
||||
})),
|
||||
(new DebugFramebufferView("GBuffer Subsurface Scattering", (pipeline) -> {
|
||||
if(!pipeline.config.is_rendering_subsurfaceScattering || Minecraft.getMinecraft().theWorld.provider.getDimensionId() != 0) throw new NoDataException();
|
||||
pipeline.useDebugViewShader(6);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
GlStateManager.bindTexture(pipeline.subsurfaceScatteringTexture);
|
||||
DrawUtils.drawStandardQuad2D();
|
||||
})),
|
||||
(new DebugFramebufferView("Light Shafts Buffer", (pipeline) -> {
|
||||
if(!pipeline.config.is_rendering_lightShafts) throw new NoDataException();
|
||||
pipeline.useDebugViewShader(6);
|
||||
|
@ -46,6 +46,7 @@ public class DeferredStateManager {
|
||||
static float materialConstantsRoughness = 0.5f;
|
||||
static float materialConstantsMetalness = 0.02f;
|
||||
static float materialConstantsEmission = 0.0f;
|
||||
static float materialConstantsSubsurfScatting = 0.0f;
|
||||
static boolean materialConstantsUseEnvMap = false;
|
||||
|
||||
static int wavingBlockOffsetSerial = 0;
|
||||
@ -103,46 +104,47 @@ public class DeferredStateManager {
|
||||
|
||||
public static boolean doCheckErrors = false;
|
||||
|
||||
public static final boolean isDeferredRenderer() {
|
||||
public static boolean isDeferredRenderer() {
|
||||
return EaglerDeferredPipeline.instance != null;
|
||||
}
|
||||
|
||||
public static final boolean isInDeferredPass() {
|
||||
public static boolean isInDeferredPass() {
|
||||
return EaglerDeferredPipeline.instance != null && GlStateManager.isExtensionPipeline();
|
||||
}
|
||||
|
||||
public static final boolean isInForwardPass() {
|
||||
public static boolean isInForwardPass() {
|
||||
return enableForwardRender && !enableShadowRender;
|
||||
}
|
||||
|
||||
public static final boolean isInParaboloidPass() {
|
||||
public static boolean isInParaboloidPass() {
|
||||
return enableParaboloidRender;
|
||||
}
|
||||
|
||||
public static final boolean isRenderingRealisticWater() {
|
||||
public static boolean isRenderingRealisticWater() {
|
||||
return EaglerDeferredPipeline.instance != null && EaglerDeferredPipeline.instance.config.is_rendering_realisticWater;
|
||||
}
|
||||
|
||||
public static final boolean isRenderingGlassHighlights() {
|
||||
public static boolean isRenderingGlassHighlights() {
|
||||
return EaglerDeferredPipeline.instance != null && EaglerDeferredPipeline.instance.config.is_rendering_useEnvMap;
|
||||
}
|
||||
|
||||
public static final void setDefaultMaterialConstants() {
|
||||
public static void setDefaultMaterialConstants() {
|
||||
materialConstantsRoughness = 0.5f;
|
||||
materialConstantsMetalness = 0.02f;
|
||||
materialConstantsEmission = 0.0f;
|
||||
materialConstantsSubsurfScatting = 0.0f;
|
||||
++materialConstantsSerial;
|
||||
}
|
||||
|
||||
public static final void startUsingEnvMap() {
|
||||
public static void startUsingEnvMap() {
|
||||
materialConstantsUseEnvMap = true;
|
||||
}
|
||||
|
||||
public static final void endUsingEnvMap() {
|
||||
public static void endUsingEnvMap() {
|
||||
materialConstantsUseEnvMap = false;
|
||||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition(int centerX, int centerY, int centerZ) {
|
||||
public static void reportForwardRenderObjectPosition(int centerX, int centerY, int centerZ) {
|
||||
EaglerDeferredPipeline instance = EaglerDeferredPipeline.instance;
|
||||
if(instance != null && enableForwardRender) {
|
||||
EaglerDeferredConfig cfg = instance.config;
|
||||
@ -153,7 +155,7 @@ public class DeferredStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition2(float x, float y, float z) {
|
||||
public static void reportForwardRenderObjectPosition2(float x, float y, float z) {
|
||||
EaglerDeferredPipeline instance = EaglerDeferredPipeline.instance;
|
||||
if(instance != null && enableForwardRender) {
|
||||
EaglerDeferredConfig cfg = instance.config;
|
||||
@ -167,114 +169,114 @@ public class DeferredStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void setHDRTranslucentPassBlendFunc() {
|
||||
public static void setHDRTranslucentPassBlendFunc() {
|
||||
GlStateManager.tryBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ZERO);
|
||||
}
|
||||
|
||||
public static final void enableMaterialTexture() {
|
||||
public static void enableMaterialTexture() {
|
||||
enableMaterialMapTexture = true;
|
||||
}
|
||||
|
||||
public static final void disableMaterialTexture() {
|
||||
public static void disableMaterialTexture() {
|
||||
enableMaterialMapTexture = false;
|
||||
}
|
||||
|
||||
public static final void enableForwardRender() {
|
||||
public static void enableForwardRender() {
|
||||
enableForwardRender = true;
|
||||
}
|
||||
|
||||
public static final void disableForwardRender() {
|
||||
public static void disableForwardRender() {
|
||||
enableForwardRender = false;
|
||||
}
|
||||
|
||||
public static final void enableParaboloidRender() {
|
||||
public static void enableParaboloidRender() {
|
||||
enableParaboloidRender = true;
|
||||
}
|
||||
|
||||
public static final void disableParaboloidRender() {
|
||||
public static void disableParaboloidRender() {
|
||||
enableParaboloidRender = false;
|
||||
}
|
||||
|
||||
public static final void enableShadowRender() {
|
||||
public static void enableShadowRender() {
|
||||
enableShadowRender = true;
|
||||
}
|
||||
|
||||
public static final void disableShadowRender() {
|
||||
public static void disableShadowRender() {
|
||||
enableShadowRender = false;
|
||||
}
|
||||
|
||||
public static final boolean isEnableShadowRender() {
|
||||
public static boolean isEnableShadowRender() {
|
||||
return enableShadowRender;
|
||||
}
|
||||
|
||||
public static final void enableClipPlane() {
|
||||
public static void enableClipPlane() {
|
||||
enableClipPlane = true;
|
||||
}
|
||||
|
||||
public static final void disableClipPlane() {
|
||||
public static void disableClipPlane() {
|
||||
enableClipPlane = false;
|
||||
}
|
||||
|
||||
public static final void setClipPlaneY(float yValue) {
|
||||
public static void setClipPlaneY(float yValue) {
|
||||
clipPlaneY = yValue;
|
||||
}
|
||||
|
||||
public static final void enableDrawWavingBlocks() {
|
||||
public static void enableDrawWavingBlocks() {
|
||||
enableDrawWavingBlocks = true;
|
||||
}
|
||||
|
||||
public static final void disableDrawWavingBlocks() {
|
||||
public static void disableDrawWavingBlocks() {
|
||||
enableDrawWavingBlocks = false;
|
||||
}
|
||||
|
||||
public static final boolean isEnableDrawWavingBlocks() {
|
||||
public static boolean isEnableDrawWavingBlocks() {
|
||||
return enableDrawWavingBlocks;
|
||||
}
|
||||
|
||||
public static final void enableDrawRealisticWaterMask() {
|
||||
public static void enableDrawRealisticWaterMask() {
|
||||
enableDrawRealisticWaterMask = true;
|
||||
}
|
||||
|
||||
public static final void disableDrawRealisticWaterMask() {
|
||||
public static void disableDrawRealisticWaterMask() {
|
||||
enableDrawRealisticWaterMask = false;
|
||||
}
|
||||
|
||||
public static final boolean isDrawRealisticWaterMask() {
|
||||
public static boolean isDrawRealisticWaterMask() {
|
||||
return enableDrawRealisticWaterMask;
|
||||
}
|
||||
|
||||
public static final void enableDrawRealisticWaterRender() {
|
||||
public static void enableDrawRealisticWaterRender() {
|
||||
enableDrawRealisticWaterRender = true;
|
||||
}
|
||||
|
||||
public static final void disableDrawRealisticWaterRender() {
|
||||
public static void disableDrawRealisticWaterRender() {
|
||||
enableDrawRealisticWaterRender = false;
|
||||
}
|
||||
|
||||
public static final boolean isDrawRealisticWaterRender() {
|
||||
public static boolean isDrawRealisticWaterRender() {
|
||||
return enableDrawRealisticWaterRender;
|
||||
}
|
||||
|
||||
public static final void enableDrawGlassHighlightsRender() {
|
||||
public static void enableDrawGlassHighlightsRender() {
|
||||
enableDrawGlassHighlightsRender = true;
|
||||
}
|
||||
|
||||
public static final void disableDrawGlassHighlightsRender() {
|
||||
public static void disableDrawGlassHighlightsRender() {
|
||||
enableDrawGlassHighlightsRender = false;
|
||||
}
|
||||
|
||||
public static final boolean isDrawGlassHighlightsRender() {
|
||||
public static boolean isDrawGlassHighlightsRender() {
|
||||
return enableDrawGlassHighlightsRender;
|
||||
}
|
||||
|
||||
public static final void setWavingBlockOffset(float x, float y, float z) {
|
||||
public static void setWavingBlockOffset(float x, float y, float z) {
|
||||
wavingBlockOffsetX = x;
|
||||
wavingBlockOffsetY = y;
|
||||
wavingBlockOffsetZ = z;
|
||||
++wavingBlockOffsetSerial;
|
||||
}
|
||||
|
||||
public static final void setWavingBlockParams(float x, float y, float z, float w) {
|
||||
public static void setWavingBlockParams(float x, float y, float z, float w) {
|
||||
wavingBlockParamX = x;
|
||||
wavingBlockParamY = y;
|
||||
wavingBlockParamZ = z;
|
||||
@ -282,34 +284,39 @@ public class DeferredStateManager {
|
||||
++wavingBlockParamSerial;
|
||||
}
|
||||
|
||||
public static final void setRoughnessConstant(float roughness) {
|
||||
public static void setRoughnessConstant(float roughness) {
|
||||
materialConstantsRoughness = roughness;
|
||||
++materialConstantsSerial;
|
||||
}
|
||||
|
||||
public static final void setMetalnessConstant(float metalness) {
|
||||
public static void setMetalnessConstant(float metalness) {
|
||||
materialConstantsMetalness = metalness;
|
||||
++materialConstantsSerial;
|
||||
}
|
||||
|
||||
public static final void setEmissionConstant(float emission) {
|
||||
public static void setEmissionConstant(float emission) {
|
||||
materialConstantsEmission = emission;
|
||||
++materialConstantsSerial;
|
||||
}
|
||||
|
||||
public static final void setBlockConstant(int blockId) {
|
||||
public static void setSubsurfScatteringConstant(float sss) {
|
||||
materialConstantsSubsurfScatting = sss;
|
||||
++materialConstantsSerial;
|
||||
}
|
||||
|
||||
public static void setBlockConstant(int blockId) {
|
||||
constantBlock = blockId;
|
||||
}
|
||||
|
||||
public static final AxisAlignedBB getShadowMapBounds() {
|
||||
public static AxisAlignedBB getShadowMapBounds() {
|
||||
return shadowMapBounds;
|
||||
}
|
||||
|
||||
public static final void setShadowMapBounds(AxisAlignedBB newShadowMapBounds) {
|
||||
public static void setShadowMapBounds(AxisAlignedBB newShadowMapBounds) {
|
||||
shadowMapBounds = newShadowMapBounds;
|
||||
}
|
||||
|
||||
public static final void loadGBufferViewMatrix() {
|
||||
public static void loadGBufferViewMatrix() {
|
||||
loadPassViewMatrix();
|
||||
viewMatrix.load(passViewMatrix);
|
||||
inverseViewMatrix.load(passInverseViewMatrix);
|
||||
@ -323,7 +330,7 @@ public class DeferredStateManager {
|
||||
projMatrixSerial = passProjMatrixSerial;
|
||||
}
|
||||
|
||||
public static final void loadPassViewMatrix() {
|
||||
public static void loadPassViewMatrix() {
|
||||
GlStateManager.getFloat(GL_MODELVIEW_MATRIX, matrixCopyBuffer);
|
||||
passViewMatrix.load(matrixCopyBuffer);
|
||||
Matrix4f.invert(passViewMatrix, passInverseViewMatrix);
|
||||
@ -338,7 +345,7 @@ public class DeferredStateManager {
|
||||
++passProjMatrixSerial;
|
||||
}
|
||||
|
||||
public static final void loadShadowPassViewMatrix() {
|
||||
public static void loadShadowPassViewMatrix() {
|
||||
GlStateManager.getFloat(GL_PROJECTION_MATRIX, matrixCopyBuffer);
|
||||
passViewMatrix.load(matrixCopyBuffer);
|
||||
Matrix4f.invert(passViewMatrix, passInverseViewMatrix);
|
||||
@ -347,7 +354,7 @@ public class DeferredStateManager {
|
||||
isShadowPassMatrixLoaded = true;
|
||||
}
|
||||
|
||||
public static final void setPassMatrixToGBuffer() {
|
||||
public static void setPassMatrixToGBuffer() {
|
||||
passViewMatrix.load(viewMatrix);
|
||||
passInverseViewMatrix.load(inverseViewMatrix);
|
||||
passProjMatrix.load(projMatrix);
|
||||
@ -378,39 +385,39 @@ public class DeferredStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void loadSunShadowMatrixLOD0() {
|
||||
public static void loadSunShadowMatrixLOD0() {
|
||||
GlStateManager.getFloat(GL_PROJECTION_MATRIX, matrixCopyBuffer);
|
||||
sunShadowMatrix0.load(matrixCopyBuffer);
|
||||
}
|
||||
|
||||
public static final void loadSunShadowMatrixLOD1() {
|
||||
public static void loadSunShadowMatrixLOD1() {
|
||||
GlStateManager.getFloat(GL_PROJECTION_MATRIX, matrixCopyBuffer);
|
||||
sunShadowMatrix1.load(matrixCopyBuffer);
|
||||
}
|
||||
|
||||
public static final void loadSunShadowMatrixLOD2() {
|
||||
public static void loadSunShadowMatrixLOD2() {
|
||||
GlStateManager.getFloat(GL_PROJECTION_MATRIX, matrixCopyBuffer);
|
||||
sunShadowMatrix2.load(matrixCopyBuffer);
|
||||
}
|
||||
|
||||
public static final Matrix4f getSunShadowMatrixLOD0() {
|
||||
public static Matrix4f getSunShadowMatrixLOD0() {
|
||||
return sunShadowMatrix0;
|
||||
}
|
||||
|
||||
public static final Matrix4f getSunShadowMatrixLOD1() {
|
||||
public static Matrix4f getSunShadowMatrixLOD1() {
|
||||
return sunShadowMatrix1;
|
||||
}
|
||||
|
||||
public static final Matrix4f getSunShadowMatrixLOD2() {
|
||||
public static Matrix4f getSunShadowMatrixLOD2() {
|
||||
return sunShadowMatrix2;
|
||||
}
|
||||
|
||||
public static final void setGBufferNearFarPlanes(float zNear, float zFar) {
|
||||
public static void setGBufferNearFarPlanes(float zNear, float zFar) {
|
||||
gbufferNearPlane = zNear;
|
||||
gbufferFarPlane = zFar;
|
||||
}
|
||||
|
||||
public static final void setWaterWindOffset(float sx, float sy, float fx, float fy) {
|
||||
public static void setWaterWindOffset(float sx, float sy, float fx, float fy) {
|
||||
++waterWindOffsetSerial;
|
||||
u_waterWindOffset4f.x = sx;
|
||||
u_waterWindOffset4f.y = sy;
|
||||
@ -435,7 +442,7 @@ public class DeferredStateManager {
|
||||
static float fogColorDarkB = 1.0f;
|
||||
static float fogColorDarkA = 1.0f;
|
||||
|
||||
public static final void enableFogLinear(float near, float far, boolean atmosphere, float colorLightR,
|
||||
public static void enableFogLinear(float near, float far, boolean atmosphere, float colorLightR,
|
||||
float colorLightG, float colorLightB, float colorLightA, float colorDarkR, float colorDarkG,
|
||||
float colorDarkB, float colorDarkA) {
|
||||
fogLinearExp = atmosphere ? 5 : 1;
|
||||
@ -451,7 +458,7 @@ public class DeferredStateManager {
|
||||
fogColorDarkA = colorDarkA;
|
||||
}
|
||||
|
||||
public static final void enableFogExp(float density, boolean atmosphere, float colorLightR, float colorLightG,
|
||||
public static void enableFogExp(float density, boolean atmosphere, float colorLightR, float colorLightG,
|
||||
float colorLightB, float colorLightA, float colorDarkR, float colorDarkG, float colorDarkB,
|
||||
float colorDarkA) {
|
||||
fogLinearExp = atmosphere ? 6 : 2;
|
||||
@ -466,11 +473,11 @@ public class DeferredStateManager {
|
||||
fogColorDarkA = colorDarkA;
|
||||
}
|
||||
|
||||
public static final void disableFog() {
|
||||
public static void disableFog() {
|
||||
fogLinearExp = 0;
|
||||
}
|
||||
|
||||
public static final void disableAll() {
|
||||
public static void disableAll() {
|
||||
enableMaterialMapTexture = false;
|
||||
materialConstantsUseEnvMap = false;
|
||||
enableForwardRender = false;
|
||||
|
@ -49,6 +49,7 @@ public class EaglerDeferredConfig {
|
||||
public boolean lensFlares = true;
|
||||
public boolean bloom = false;
|
||||
public boolean fxaa = true;
|
||||
public boolean subsurfaceScattering = true;
|
||||
|
||||
public boolean is_rendering_wavingBlocks = true;
|
||||
public boolean is_rendering_dynamicLights = true;
|
||||
@ -65,6 +66,7 @@ public class EaglerDeferredConfig {
|
||||
public boolean is_rendering_lensFlares = true;
|
||||
public boolean is_rendering_bloom = false;
|
||||
public boolean is_rendering_fxaa = true;
|
||||
public boolean is_rendering_subsurfaceScattering = true;
|
||||
|
||||
public void readOption(String key, String value) {
|
||||
switch(key) {
|
||||
@ -110,6 +112,9 @@ public class EaglerDeferredConfig {
|
||||
case "shaders_deferred_fxaa":
|
||||
fxaa = value.equals("true");
|
||||
break;
|
||||
case "shaders_deferred_subsurfaceScattering":
|
||||
subsurfaceScattering = value.equals("true");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -130,6 +135,7 @@ public class EaglerDeferredConfig {
|
||||
output.println("shaders_deferred_lensFlares:" + lensFlares);
|
||||
output.println("shaders_deferred_bloom:" + bloom);
|
||||
output.println("shaders_deferred_fxaa:" + fxaa);
|
||||
output.println("shaders_deferred_subsurfaceScattering:" + subsurfaceScattering);
|
||||
}
|
||||
|
||||
public void reloadShaderPackInfo(IResourceManager mgr) throws IOException {
|
||||
@ -159,6 +165,7 @@ public class EaglerDeferredConfig {
|
||||
is_rendering_lensFlares = lensFlares && shaderPackInfo.POST_LENS_FLARES;
|
||||
is_rendering_bloom = bloom && shaderPackInfo.POST_BLOOM;
|
||||
is_rendering_fxaa = fxaa && shaderPackInfo.POST_FXAA;
|
||||
is_rendering_subsurfaceScattering = subsurfaceScattering && is_rendering_shadowsSun_clamped > 0 && shaderPackInfo.SUBSURFACE_SCATTERING;
|
||||
}
|
||||
|
||||
}
|
@ -59,6 +59,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.PipelineShaderS
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.PipelineShaderSkyboxIrradiance;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.PipelineShaderSkyboxRender;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.PipelineShaderSkyboxRenderEnd;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.PipelineShaderSubsurfaceScattering;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.PipelineShaderTonemap;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderMissingException;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.texture.MetalsLUT;
|
||||
@ -150,6 +151,9 @@ public class EaglerDeferredPipeline {
|
||||
public IFramebufferGL sunLightingShadowFramebuffer = null;
|
||||
public int sunLightingShadowTexture = -1;
|
||||
|
||||
public IFramebufferGL subsurfaceScatteringFramebuffer = null;
|
||||
public int subsurfaceScatteringTexture = -1;
|
||||
|
||||
public IFramebufferGL ssaoGenerateFramebuffer = null;
|
||||
public int ssaoGenerateTexture = -1;
|
||||
|
||||
@ -157,6 +161,9 @@ public class EaglerDeferredPipeline {
|
||||
|
||||
public int ssaoNoiseTexture = -1;
|
||||
|
||||
public IFramebufferGL skyFramebuffer = null;
|
||||
public int skyTexture = -1;
|
||||
|
||||
public IFramebufferGL lightingHDRFramebuffer = null;
|
||||
public int lightingHDRFramebufferColorTexture = -1;
|
||||
public int lightingHDRFramebufferDepthTexture = -1;
|
||||
@ -297,6 +304,7 @@ public class EaglerDeferredPipeline {
|
||||
public PipelineShaderRealisticWaterNormalsMix shader_realistic_water_normals_mix = null;
|
||||
public PipelineShaderHandDepthMask shader_hand_depth_mask = null;
|
||||
public PipelineShaderFXAA shader_post_fxaa = null;
|
||||
public PipelineShaderSubsurfaceScattering shader_subsurface_scattering = null;
|
||||
public SkyboxRenderer skybox = null;
|
||||
public LightSourceMesh pointLightMesh = null;
|
||||
public final GBufferAcceleratedEffectRenderer gbufferEffectRenderer = new GBufferAcceleratedEffectRenderer();
|
||||
@ -456,6 +464,16 @@ public class EaglerDeferredPipeline {
|
||||
GlStateManager.bindTexture(sunLightingShadowTexture);
|
||||
setNearest();
|
||||
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, EaglercraftGPU.getNativeTexture(sunLightingShadowTexture), 0);
|
||||
if(config.is_rendering_subsurfaceScattering) {
|
||||
shader_subsurface_scattering = PipelineShaderSubsurfaceScattering.compile(lods, sunShadowDepthBufferRes, sunShadowDepthBufferRes * lods);
|
||||
shader_subsurface_scattering.loadUniforms();
|
||||
subsurfaceScatteringFramebuffer = _wglCreateFramebuffer();
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, subsurfaceScatteringFramebuffer);
|
||||
subsurfaceScatteringTexture = GlStateManager.generateTexture();
|
||||
GlStateManager.bindTexture(subsurfaceScatteringTexture);
|
||||
setNearest();
|
||||
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, EaglercraftGPU.getNativeTexture(subsurfaceScatteringTexture), 0);
|
||||
}
|
||||
if(config.is_rendering_shadowsColored) {
|
||||
sunShadowColorFramebuffer = _wglCreateFramebuffer();
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, sunShadowColorFramebuffer);
|
||||
@ -594,6 +612,13 @@ public class EaglerDeferredPipeline {
|
||||
setNearest();
|
||||
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, EaglercraftGPU.getNativeTexture(lightingHDRFramebufferDepthTexture), 0);
|
||||
|
||||
skyFramebuffer = _wglCreateFramebuffer();
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, skyFramebuffer);
|
||||
skyTexture = GlStateManager.generateTexture();
|
||||
GlStateManager.bindTexture(skyTexture);
|
||||
setLinear();
|
||||
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, EaglercraftGPU.getNativeTexture(skyTexture), 0);
|
||||
|
||||
handRenderFramebuffer = _wglCreateFramebuffer();
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, handRenderFramebuffer);
|
||||
GlStateManager.bindTexture(lightingHDRFramebufferColorTexture);
|
||||
@ -641,7 +666,7 @@ public class EaglerDeferredPipeline {
|
||||
DeferredStateManager.checkGLError("Post: rebuild pipeline: dither8x8Texture");
|
||||
|
||||
shader_lighting_sun = PipelineShaderLightingSun.compile(shadowsSun ? config.is_rendering_shadowsSun_clamped : 0,
|
||||
config.is_rendering_shadowsColored);
|
||||
config.is_rendering_shadowsColored, config.is_rendering_subsurfaceScattering);
|
||||
shader_lighting_sun.loadUniforms();
|
||||
if(shadowsSun) {
|
||||
shader_shadows_sun = PipelineShaderShadowsSun.compile(config.is_rendering_shadowsSun_clamped,
|
||||
@ -1233,12 +1258,21 @@ public class EaglerDeferredPipeline {
|
||||
DeferredStateManager.checkGLError("Post: resize pipeline: lightShafts");
|
||||
}
|
||||
|
||||
if(config.is_rendering_subsurfaceScattering) {
|
||||
GlStateManager.bindTexture(subsurfaceScatteringTexture);
|
||||
_wglTexImage2D(GL_TEXTURE_2D, 0, _GL_R8, reprojectionTexWidth, reprojectionTexHeight, 0, GL_RED, GL_UNSIGNED_BYTE, (ByteBuffer)null);
|
||||
DeferredStateManager.checkGLError("Post: resize pipeline: subsurfaceScattering");
|
||||
}
|
||||
|
||||
GlStateManager.bindTexture(lightingHDRFramebufferColorTexture);
|
||||
EaglercraftGPU.createFramebufferHDR16FTexture(GL_TEXTURE_2D, 0, w, h, GL_RGBA, true); // USE RGBA! WebGL won't render to RGB16F
|
||||
|
||||
GlStateManager.bindTexture(lightingHDRFramebufferDepthTexture);
|
||||
_wglTexImage2D(GL_TEXTURE_2D, 0, _GL_DEPTH_COMPONENT32F, w, h, 0, _GL_DEPTH_COMPONENT, GL_FLOAT, (ByteBuffer)null);
|
||||
|
||||
GlStateManager.bindTexture(skyTexture);
|
||||
EaglercraftGPU.createFramebufferHDR16FTexture(GL_TEXTURE_2D, 0, reprojectionTexWidth, reprojectionTexHeight, GL_RGBA, true);
|
||||
|
||||
GlStateManager.bindTexture(handRenderFramebufferDepthTexture);
|
||||
_wglTexImage2D(GL_TEXTURE_2D, 0, _GL_DEPTH_COMPONENT32F, w, h, 0, _GL_DEPTH_COMPONENT, GL_FLOAT, (ByteBuffer)null);
|
||||
|
||||
@ -1367,8 +1401,8 @@ public class EaglerDeferredPipeline {
|
||||
resize(mc.displayWidth, mc.displayHeight);
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, gBufferFramebuffer);
|
||||
_wglDrawBuffers(gBufferDrawBuffers);
|
||||
_wglClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
_wglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
GlStateManager.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GlStateManager.viewport(0, 0, currentWidth, currentHeight);
|
||||
GlStateManager.colorMask(true, true, true, true);
|
||||
@ -1422,7 +1456,7 @@ public class EaglerDeferredPipeline {
|
||||
GlStateManager.clear(GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.cullFace(GL_FRONT);
|
||||
//GlStateManager.cullFace(GL_FRONT);
|
||||
DeferredStateManager.enableShadowRender();
|
||||
GlStateManager.colorMask(false, false, false, false);
|
||||
DeferredStateManager.checkGLError("Post: beginDrawMainShadowMap()");
|
||||
@ -1431,7 +1465,7 @@ public class EaglerDeferredPipeline {
|
||||
public void endDrawMainShadowMap() {
|
||||
DeferredStateManager.checkGLError("Pre: endDrawMainShadowMap()");
|
||||
GlStateManager.viewport(0, 0, currentWidth, currentHeight);
|
||||
GlStateManager.cullFace(GL_BACK);
|
||||
//GlStateManager.cullFace(GL_BACK);
|
||||
DeferredStateManager.disableShadowRender();
|
||||
GlStateManager.colorMask(true, true, true, true);
|
||||
DeferredStateManager.checkGLError("Post: endDrawMainShadowMap()");
|
||||
@ -1653,7 +1687,7 @@ public class EaglerDeferredPipeline {
|
||||
// =============== NETHER SKY REFLECTION MAP ================ //
|
||||
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, envMapSkyFramebuffer);
|
||||
GlStateManager.clearColor(0.55f, 0.25f, 0.05f, 1.0f);
|
||||
GlStateManager.clearColor(0.055f, 0.025f, 0.005f, 1.0f);
|
||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): NETHER SKY REFLECTION MAP");
|
||||
@ -1908,6 +1942,17 @@ public class EaglerDeferredPipeline {
|
||||
uniformMatrixHelper(shader_shadows_sun.uniforms.u_inverseViewMatrix4f, DeferredStateManager.inverseViewMatrix);
|
||||
uniformMatrixHelper(shader_shadows_sun.uniforms.u_inverseViewProjMatrix4f, tmpMatrixInverseViewProj);
|
||||
|
||||
Matrix4f.mul(tmpClipToTexSpaceMatLeft, DeferredStateManager.sunShadowMatrix0, tmpShadowLOD0MatrixTexSpace);
|
||||
uniformMatrixHelper(shader_shadows_sun.uniforms.u_sunShadowMatrixLOD04f, tmpShadowLOD0MatrixTexSpace);
|
||||
if(config.is_rendering_shadowsSun_clamped > 1) {
|
||||
Matrix4f.mul(tmpClipToTexSpaceMatLeft, DeferredStateManager.sunShadowMatrix1, tmpShadowLOD1MatrixTexSpace);
|
||||
uniformMatrixHelper(shader_shadows_sun.uniforms.u_sunShadowMatrixLOD14f, tmpShadowLOD1MatrixTexSpace);
|
||||
if(config.is_rendering_shadowsSun_clamped > 2) {
|
||||
Matrix4f.mul(tmpClipToTexSpaceMatLeft, DeferredStateManager.sunShadowMatrix2, tmpShadowLOD2MatrixTexSpace);
|
||||
uniformMatrixHelper(shader_shadows_sun.uniforms.u_sunShadowMatrixLOD24f, tmpShadowLOD2MatrixTexSpace);
|
||||
}
|
||||
}
|
||||
|
||||
if(config.is_rendering_shadowsColored) {
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE3);
|
||||
GlStateManager.bindTexture(sunShadowColorBuffer);
|
||||
@ -1921,16 +1966,6 @@ public class EaglerDeferredPipeline {
|
||||
GlStateManager.bindTexture(gBufferDepthTexture);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
GlStateManager.bindTexture(gBufferNormalsTexture);
|
||||
Matrix4f.mul(tmpClipToTexSpaceMatLeft, DeferredStateManager.sunShadowMatrix0, tmpShadowLOD0MatrixTexSpace);
|
||||
uniformMatrixHelper(shader_shadows_sun.uniforms.u_sunShadowMatrixLOD04f, tmpShadowLOD0MatrixTexSpace);
|
||||
if(config.is_rendering_shadowsSun_clamped > 1) {
|
||||
Matrix4f.mul(tmpClipToTexSpaceMatLeft, DeferredStateManager.sunShadowMatrix1, tmpShadowLOD1MatrixTexSpace);
|
||||
uniformMatrixHelper(shader_shadows_sun.uniforms.u_sunShadowMatrixLOD14f, tmpShadowLOD1MatrixTexSpace);
|
||||
if(config.is_rendering_shadowsSun_clamped > 2) {
|
||||
Matrix4f.mul(tmpClipToTexSpaceMatLeft, DeferredStateManager.sunShadowMatrix2, tmpShadowLOD2MatrixTexSpace);
|
||||
uniformMatrixHelper(shader_shadows_sun.uniforms.u_sunShadowMatrixLOD24f, tmpShadowLOD2MatrixTexSpace);
|
||||
}
|
||||
}
|
||||
|
||||
Vector3f currentSunShadowAngle = DeferredStateManager.currentSunLightAngle;
|
||||
_wglUniform3f(shader_shadows_sun.uniforms.u_sunDirection3f, -currentSunShadowAngle.x, -currentSunShadowAngle.y, -currentSunShadowAngle.z);
|
||||
@ -1943,28 +1978,175 @@ public class EaglerDeferredPipeline {
|
||||
}
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER SUNLIGHT SHADOWS");
|
||||
|
||||
if(config.is_rendering_subsurfaceScattering && dim == 0) {
|
||||
|
||||
// ==================== RENDER SUBSURFACE SCATTERING ===================== //
|
||||
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, subsurfaceScatteringFramebuffer);
|
||||
GlStateManager.viewport(0, 0, reprojectionTexWidth, reprojectionTexHeight);
|
||||
|
||||
shader_subsurface_scattering.useProgram();
|
||||
uniformMatrixHelper(shader_subsurface_scattering.uniforms.u_inverseViewMatrix4f, DeferredStateManager.inverseViewMatrix);
|
||||
uniformMatrixHelper(shader_subsurface_scattering.uniforms.u_inverseViewProjMatrix4f, tmpMatrixInverseViewProj);
|
||||
|
||||
uniformMatrixHelper(shader_subsurface_scattering.uniforms.u_sunShadowMatrixLOD04f, tmpShadowLOD0MatrixTexSpace);
|
||||
if(config.is_rendering_shadowsSun_clamped > 1) {
|
||||
uniformMatrixHelper(shader_subsurface_scattering.uniforms.u_sunShadowMatrixLOD14f, tmpShadowLOD1MatrixTexSpace);
|
||||
if(config.is_rendering_shadowsSun_clamped > 2) {
|
||||
uniformMatrixHelper(shader_subsurface_scattering.uniforms.u_sunShadowMatrixLOD24f, tmpShadowLOD2MatrixTexSpace);
|
||||
}
|
||||
}
|
||||
|
||||
_wglUniform3f(shader_subsurface_scattering.uniforms.u_sunDirection3f, -currentSunShadowAngle.x, -currentSunShadowAngle.y, -currentSunShadowAngle.z);
|
||||
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE3);
|
||||
GlStateManager.bindTexture(sunShadowDepthBuffer);
|
||||
_wglTexParameteri(GL_TEXTURE_2D, _GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE2);
|
||||
GlStateManager.bindTexture(gBufferMaterialTexture);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE1);
|
||||
GlStateManager.bindTexture(gBufferDepthTexture);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
GlStateManager.bindTexture(gBufferNormalsTexture);
|
||||
|
||||
DrawUtils.drawStandardQuad2D();
|
||||
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE3);
|
||||
_wglTexParameteri(GL_TEXTURE_2D, _GL_TEXTURE_COMPARE_MODE, _GL_COMPARE_REF_TO_TEXTURE);
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER SUBSURFACE SCATTERING");
|
||||
}
|
||||
}
|
||||
|
||||
// ================ INITIALIZE HDR FRAMEBUFFER ================== //
|
||||
// =================== RENDER SKYBOX MESH =================== //
|
||||
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, skyFramebuffer);
|
||||
GlStateManager.viewport(0, 0, reprojectionTexWidth, reprojectionTexHeight);
|
||||
|
||||
if(dim == 0) {
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE3);
|
||||
GlStateManager.bindTexture(gBufferDepthTexture);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE2);
|
||||
GlStateManager.bindTexture(CloudRenderWorker.cloudOcclusionTexture);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE1);
|
||||
CloudRenderWorker.bindParaboloid();
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
GlStateManager.bindTexture(atmosphereHDRFramebufferColorTexture);
|
||||
shader_skybox_render.useProgram();
|
||||
uniformMatrixHelper(shader_skybox_render.uniforms.u_viewMatrix4f, DeferredStateManager.viewMatrix);
|
||||
uniformMatrixHelper(shader_skybox_render.uniforms.u_projMatrix4f, DeferredStateManager.projMatrix);
|
||||
_wglUniform3f(shader_skybox_render.uniforms.u_sunDirection3f, -currentSunAngle.x, -currentSunAngle.y, -currentSunAngle.z);
|
||||
float mag = 25.0f;
|
||||
float[] sunRGB2 = TemperaturesLUT.getColorTemperature((int)sunKelvin - 1000);
|
||||
_wglUniform3f(shader_skybox_render.uniforms.u_sunColor3f, sunRGB2[0] * mag, sunRGB2[1] * mag, sunRGB2[2] * mag);
|
||||
if (mc.theWorld.getLastLightningBolt() > 0) {
|
||||
float f = 0.3f + fff;
|
||||
_wglUniform4f(shader_skybox_render.uniforms.u_lightningColor4f, 0.02f * f, 0.02f * f, 0.02f * f, 1.0f - f * 0.25f);
|
||||
}else {
|
||||
_wglUniform4f(shader_skybox_render.uniforms.u_lightningColor4f, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
skybox.drawFull();
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER SKYBOX MESH");
|
||||
}else if(dim == 1) {
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
mc.getTextureManager().bindTexture(locationEndSkyPng);
|
||||
|
||||
if(shader_skybox_render_end == null) {
|
||||
shader_skybox_render_end = PipelineShaderSkyboxRenderEnd.compile();
|
||||
shader_skybox_render_end.loadUniforms();
|
||||
}
|
||||
|
||||
shader_skybox_render_end.useProgram();
|
||||
uniformMatrixHelper(shader_skybox_render_end.uniforms.u_viewMatrix4f, DeferredStateManager.viewMatrix);
|
||||
uniformMatrixHelper(shader_skybox_render_end.uniforms.u_projMatrix4f, DeferredStateManager.projMatrix);
|
||||
_wglUniform2f(shader_skybox_render_end.uniforms.u_skyTextureScale2f, 4.0f, 4.0f);
|
||||
|
||||
skybox.drawFull();
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER SKYBOX MESH");
|
||||
}else if(dim == -1) {
|
||||
GlStateManager.clearColor(0.055f, 0.025f, 0.005f, 1.0f);
|
||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
// ================ INITIALIZE DEPTH BUFFER ================== //
|
||||
|
||||
GlStateManager.viewport(0, 0, currentWidth, currentHeight);
|
||||
_wglBindFramebuffer(_GL_READ_FRAMEBUFFER, gBufferFramebuffer);
|
||||
_wglBindFramebuffer(_GL_DRAW_FRAMEBUFFER, lightingHDRFramebuffer);
|
||||
_wglBlitFramebuffer(0, 0, currentWidth, currentHeight, 0, 0, currentWidth, currentHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, lightingHDRFramebuffer);
|
||||
|
||||
if(dim == -1) {
|
||||
float f = 0.13f;
|
||||
GlStateManager.clearColor(0.57f * 0.57f * f, 0.38f * 0.38f * f, 0.20f * 0.20f * f, 0.0f);
|
||||
}else {
|
||||
GlStateManager.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT);
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): INITIALIZE DEPTH BUFFER");
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): INITIALIZE HDR FRAMEBUFFER");
|
||||
// ===================== COPY SKY TEXTURE ====================== //
|
||||
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, lightingHDRFramebuffer);
|
||||
GlStateManager.viewport(0, 0, currentWidth, currentHeight);
|
||||
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
GlStateManager.bindTexture(skyTexture);
|
||||
TextureCopyUtil.blitTexture();
|
||||
|
||||
if(dim == 0 && fff < 1.0f) {
|
||||
|
||||
// ===================== RENDER MOON ====================== //
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
Matrix4f moonMatrix = tmpMatrix2;
|
||||
moonMatrix.setIdentity();
|
||||
tmpVector3.set(-1.0f, -1.0f, 1.0f);
|
||||
Matrix4f.scale(tmpVector3, moonMatrix, moonMatrix);
|
||||
tmpVector3.set(0.0f, 0.0f, 1.0f);
|
||||
Matrix4f.rotate(2.7f, tmpVector3, moonMatrix, moonMatrix);
|
||||
tmpVector3.set(-1.0f, 0.0f, 0.0f);
|
||||
tmpVector4.set(currentSunAngle);
|
||||
tmpVector4.scale(-1.0f);
|
||||
Vector3f.cross(tmpVector3, tmpVector4, tmpVector1);
|
||||
Vector3f.cross(tmpVector4, tmpVector1, tmpVector3);
|
||||
moonMatrix = tmpMatrix1;
|
||||
moonMatrix.setIdentity();
|
||||
moonMatrix.m00 = tmpVector1.x;
|
||||
moonMatrix.m01 = tmpVector1.y;
|
||||
moonMatrix.m02 = tmpVector1.z;
|
||||
moonMatrix.m10 = tmpVector3.x;
|
||||
moonMatrix.m11 = tmpVector3.y;
|
||||
moonMatrix.m12 = tmpVector3.z;
|
||||
moonMatrix.m20 = tmpVector4.x;
|
||||
moonMatrix.m21 = tmpVector4.y;
|
||||
moonMatrix.m22 = tmpVector4.z;
|
||||
Matrix4f.mul(moonMatrix, tmpMatrix2, moonMatrix);
|
||||
|
||||
GlStateManager.bindTexture(moonTextures);
|
||||
shader_moon_render.useProgram();
|
||||
|
||||
uniformMatrixHelper(shader_moon_render.uniforms.u_modelMatrix4f, moonMatrix);
|
||||
uniformMatrixHelper(shader_moon_render.uniforms.u_viewMatrix4f, DeferredStateManager.viewMatrix);
|
||||
uniformMatrixHelper(shader_moon_render.uniforms.u_projMatrix4f, DeferredStateManager.projMatrix);
|
||||
float fffff = 0.1f + MathHelper.clamp_float((-currentSunAngle.y + 0.1f) * 6.0f, 0.0f, 0.375f);
|
||||
_wglUniform3f(shader_moon_render.uniforms.u_moonColor3f, 1.4f * fffff, 1.2f * fffff, 1.0f * fffff);
|
||||
|
||||
float f = (float)(Minecraft.getMinecraft().theWorld.getWorldTime() - 18000f) / 24000f / 4f * 3.14159f;
|
||||
_wglUniform3f(shader_moon_render.uniforms.u_lightDir3f, MathHelper.sin(f), 0.0f, MathHelper.cos(f));
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GL_ONE, GL_ONE, GL_ZERO, GL_ZERO);
|
||||
|
||||
DrawUtils.drawStandardQuad2D();
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER MOON");
|
||||
}
|
||||
|
||||
// ================= RENDER AMBIENT LIGHTING ==================== //
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE9);
|
||||
GlStateManager.bindTexture(MetalsLUT.getGLTexture());
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE8);
|
||||
@ -2020,6 +2202,11 @@ public class EaglerDeferredPipeline {
|
||||
shader_lighting_sun.useProgram();
|
||||
uniformMatrixHelper(shader_lighting_sun.uniforms.u_inverseViewMatrix4f, DeferredStateManager.inverseViewMatrix);
|
||||
uniformMatrixHelper(shader_lighting_sun.uniforms.u_inverseProjectionMatrix4f, DeferredStateManager.inverseProjMatrix);
|
||||
if(config.is_rendering_subsurfaceScattering) {
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE6);
|
||||
GlStateManager.bindTexture(subsurfaceScatteringTexture);
|
||||
}
|
||||
_wglTexParameteri(GL_TEXTURE_2D, _GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE5);
|
||||
GlStateManager.bindTexture(MetalsLUT.getGLTexture());
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE4);
|
||||
@ -2029,7 +2216,7 @@ public class EaglerDeferredPipeline {
|
||||
GlStateManager.bindTexture(-1);
|
||||
}
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
|
||||
|
||||
float ffff = getSkyBrightnessParam();
|
||||
float[] sunRGB;
|
||||
if(currentSunAngle.y < 0.05f) {
|
||||
@ -2047,11 +2234,11 @@ public class EaglerDeferredPipeline {
|
||||
currentSunLightColor3f.z = sunRGB[2] * 0.3f * (0.2f + ffff * 0.8f);
|
||||
_wglUniform3f(shader_lighting_sun.uniforms.u_sunColor3f, sunRGB[0] * 0.1f * (0.5f + ffff * 0.5f), sunRGB[1] * 0.1f * (0.5f + ffff * 0.5f), sunRGB[2] * 0.1f * (0.5f + ffff * 0.5f));
|
||||
}
|
||||
|
||||
|
||||
_wglUniform3f(shader_lighting_sun.uniforms.u_sunDirection3f, -DeferredStateManager.currentSunLightAngle.x, -DeferredStateManager.currentSunLightAngle.y, -DeferredStateManager.currentSunLightAngle.z);
|
||||
|
||||
|
||||
DrawUtils.drawStandardQuad2D();
|
||||
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER SUNLIGHT");
|
||||
}else {
|
||||
DeferredStateManager.currentSunLightColor.set(0.0f, 0.0f, 0.0f);
|
||||
@ -2124,101 +2311,6 @@ public class EaglerDeferredPipeline {
|
||||
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, lightingHDRFramebuffer);
|
||||
|
||||
// =================== RENDER SKYBOX MESH =================== //
|
||||
|
||||
if(dim == 0) {
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE2);
|
||||
GlStateManager.bindTexture(CloudRenderWorker.cloudOcclusionTexture);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE1);
|
||||
CloudRenderWorker.bindParaboloid();
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
GlStateManager.bindTexture(atmosphereHDRFramebufferColorTexture);
|
||||
shader_skybox_render.useProgram();
|
||||
uniformMatrixHelper(shader_skybox_render.uniforms.u_viewMatrix4f, DeferredStateManager.viewMatrix);
|
||||
uniformMatrixHelper(shader_skybox_render.uniforms.u_projMatrix4f, DeferredStateManager.projMatrix);
|
||||
_wglUniform3f(shader_skybox_render.uniforms.u_sunDirection3f, -currentSunAngle.x, -currentSunAngle.y, -currentSunAngle.z);
|
||||
float mag = 25.0f;
|
||||
float[] sunRGB2 = TemperaturesLUT.getColorTemperature((int)sunKelvin - 1000);
|
||||
_wglUniform3f(shader_skybox_render.uniforms.u_sunColor3f, sunRGB2[0] * mag, sunRGB2[1] * mag, sunRGB2[2] * mag);
|
||||
if (mc.theWorld.getLastLightningBolt() > 0) {
|
||||
float f = 0.3f + fff;
|
||||
_wglUniform4f(shader_skybox_render.uniforms.u_lightningColor4f, 0.02f * f, 0.02f * f, 0.02f * f, 1.0f - f * 0.25f);
|
||||
}else {
|
||||
_wglUniform4f(shader_skybox_render.uniforms.u_lightningColor4f, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
skybox.drawFull();
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER SKYBOX MESH");
|
||||
}else if(dim == 1) {
|
||||
GlStateManager.enableDepth();
|
||||
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE0);
|
||||
mc.getTextureManager().bindTexture(locationEndSkyPng);
|
||||
|
||||
if(shader_skybox_render_end == null) {
|
||||
shader_skybox_render_end = PipelineShaderSkyboxRenderEnd.compile();
|
||||
shader_skybox_render_end.loadUniforms();
|
||||
}
|
||||
|
||||
shader_skybox_render_end.useProgram();
|
||||
uniformMatrixHelper(shader_skybox_render_end.uniforms.u_viewMatrix4f, DeferredStateManager.viewMatrix);
|
||||
uniformMatrixHelper(shader_skybox_render_end.uniforms.u_projMatrix4f, DeferredStateManager.projMatrix);
|
||||
_wglUniform2f(shader_skybox_render_end.uniforms.u_skyTextureScale2f, 4.0f, 4.0f);
|
||||
|
||||
skybox.drawFull();
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER SKYBOX MESH");
|
||||
}
|
||||
|
||||
if(dim == 0 && fff < 1.0f) {
|
||||
|
||||
// ===================== RENDER MOON ====================== //
|
||||
|
||||
Matrix4f moonMatrix = tmpMatrix2;
|
||||
moonMatrix.setIdentity();
|
||||
tmpVector3.set(-1.0f, -1.0f, 1.0f);
|
||||
Matrix4f.scale(tmpVector3, moonMatrix, moonMatrix);
|
||||
tmpVector3.set(0.0f, 0.0f, 1.0f);
|
||||
Matrix4f.rotate(2.7f, tmpVector3, moonMatrix, moonMatrix);
|
||||
tmpVector3.set(-1.0f, 0.0f, 0.0f);
|
||||
tmpVector4.set(currentSunAngle);
|
||||
tmpVector4.scale(-1.0f);
|
||||
Vector3f.cross(tmpVector3, tmpVector4, tmpVector1);
|
||||
Vector3f.cross(tmpVector4, tmpVector1, tmpVector3);
|
||||
moonMatrix = tmpMatrix1;
|
||||
moonMatrix.setIdentity();
|
||||
moonMatrix.m00 = tmpVector1.x;
|
||||
moonMatrix.m01 = tmpVector1.y;
|
||||
moonMatrix.m02 = tmpVector1.z;
|
||||
moonMatrix.m10 = tmpVector3.x;
|
||||
moonMatrix.m11 = tmpVector3.y;
|
||||
moonMatrix.m12 = tmpVector3.z;
|
||||
moonMatrix.m20 = tmpVector4.x;
|
||||
moonMatrix.m21 = tmpVector4.y;
|
||||
moonMatrix.m22 = tmpVector4.z;
|
||||
Matrix4f.mul(moonMatrix, tmpMatrix2, moonMatrix);
|
||||
|
||||
GlStateManager.bindTexture(moonTextures);
|
||||
shader_moon_render.useProgram();
|
||||
|
||||
uniformMatrixHelper(shader_moon_render.uniforms.u_modelMatrix4f, moonMatrix);
|
||||
uniformMatrixHelper(shader_moon_render.uniforms.u_viewMatrix4f, DeferredStateManager.viewMatrix);
|
||||
uniformMatrixHelper(shader_moon_render.uniforms.u_projMatrix4f, DeferredStateManager.projMatrix);
|
||||
float fffff = 0.1f + MathHelper.clamp_float((-currentSunAngle.y + 0.1f) * 8.0f, 0.0f, 0.5f);
|
||||
_wglUniform3f(shader_moon_render.uniforms.u_moonColor3f, 1.4f * fffff, 1.2f * fffff, 1.0f * fffff);
|
||||
|
||||
float f = (float)(Minecraft.getMinecraft().theWorld.getWorldTime() - 18000f) / 24000f / 4f * 3.14159f;
|
||||
_wglUniform3f(shader_moon_render.uniforms.u_lightDir3f, MathHelper.sin(f), 0.0f, MathHelper.cos(f));
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GL_ONE, GL_ONE, GL_ZERO, GL_ZERO);
|
||||
|
||||
DrawUtils.drawStandardQuad2D();
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER MOON");
|
||||
}
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.disableBlend();
|
||||
@ -2883,6 +2975,8 @@ public class EaglerDeferredPipeline {
|
||||
_wglBindFramebuffer(_GL_DRAW_FRAMEBUFFER, fogDepthCopyBuffer);
|
||||
_wglBlitFramebuffer(0, 0, currentWidth, currentHeight, 0, 0, currentWidth, currentHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, lightingHDRFramebuffer);
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE5);
|
||||
GlStateManager.bindTexture(skyTexture);
|
||||
if(config.is_rendering_lightShafts) {
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE4);
|
||||
GlStateManager.bindTexture(lightShaftsTexture);
|
||||
@ -3038,6 +3132,10 @@ public class EaglerDeferredPipeline {
|
||||
|
||||
public void beginDrawTranslucentEntities() {
|
||||
DeferredStateManager.checkGLError("Pre: beginDrawTranslucentEntities()");
|
||||
if(config.is_rendering_useEnvMap) {
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE5);
|
||||
GlStateManager.bindTexture(envMapColorTexture);
|
||||
}
|
||||
GlStateManager.setActiveTexture(GL_TEXTURE4);
|
||||
if(config.is_rendering_shadowsSun_clamped > 0) {
|
||||
GlStateManager.bindTexture(sunShadowDepthBuffer);
|
||||
@ -3559,6 +3657,14 @@ public class EaglerDeferredPipeline {
|
||||
GlStateManager.deleteTexture(sunLightingShadowTexture);
|
||||
sunLightingShadowTexture = -1;
|
||||
}
|
||||
if(subsurfaceScatteringFramebuffer != null) {
|
||||
_wglDeleteFramebuffer(subsurfaceScatteringFramebuffer);
|
||||
subsurfaceScatteringFramebuffer = null;
|
||||
}
|
||||
if(subsurfaceScatteringTexture != -1) {
|
||||
GlStateManager.deleteTexture(subsurfaceScatteringTexture);
|
||||
subsurfaceScatteringTexture = -1;
|
||||
}
|
||||
if(ssaoGenerateFramebuffer != null) {
|
||||
_wglDeleteFramebuffer(ssaoGenerateFramebuffer);
|
||||
ssaoGenerateFramebuffer = null;
|
||||
@ -3627,6 +3733,14 @@ public class EaglerDeferredPipeline {
|
||||
GlStateManager.deleteTexture(lastFrameGBufferDepthTexture);
|
||||
lastFrameGBufferDepthTexture = -1;
|
||||
}
|
||||
if(skyFramebuffer != null) {
|
||||
_wglDeleteFramebuffer(skyFramebuffer);
|
||||
skyFramebuffer = null;
|
||||
}
|
||||
if(skyTexture != -1) {
|
||||
GlStateManager.deleteTexture(skyTexture);
|
||||
skyTexture = -1;
|
||||
}
|
||||
if(lightingHDRFramebuffer != null) {
|
||||
_wglDeleteFramebuffer(lightingHDRFramebuffer);
|
||||
lightingHDRFramebuffer = null;
|
||||
@ -3887,6 +4001,10 @@ public class EaglerDeferredPipeline {
|
||||
shader_post_fxaa.destroy();
|
||||
shader_post_fxaa = null;
|
||||
}
|
||||
if(shader_subsurface_scattering != null) {
|
||||
shader_subsurface_scattering.destroy();
|
||||
shader_subsurface_scattering = null;
|
||||
}
|
||||
if(shader_skybox_render_paraboloid != null) {
|
||||
shader_skybox_render_paraboloid.destroy();
|
||||
shader_skybox_render_paraboloid = null;
|
||||
@ -4069,11 +4187,11 @@ public class EaglerDeferredPipeline {
|
||||
}
|
||||
}
|
||||
|
||||
public static final boolean isSupported() {
|
||||
public static boolean isSupported() {
|
||||
return EaglercraftGPU.checkOpenGLESVersion() >= 300 && EaglercraftGPU.checkHasHDRFramebufferSupportWithFilter();
|
||||
}
|
||||
|
||||
public static final String getReasonUnsupported() {
|
||||
public static String getReasonUnsupported() {
|
||||
if(EaglercraftGPU.checkOpenGLESVersion() < 300) {
|
||||
return I18n.format("shaders.gui.unsupported.reason.oldOpenGLVersion");
|
||||
}else if(!EaglercraftGPU.checkHasHDRFramebufferSupportWithFilter()) {
|
||||
@ -4083,7 +4201,7 @@ public class EaglerDeferredPipeline {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void renderSuspended() {
|
||||
public static void renderSuspended() {
|
||||
_wglBindFramebuffer(_GL_FRAMEBUFFER, null);
|
||||
GlStateManager.globalEnableBlend();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
@ -20,7 +20,7 @@ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
|
||||
@ -46,7 +46,7 @@ public class ForwardAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
||||
|
||||
private PipelineShaderAccelParticleForward shaderProgram = null;
|
||||
|
||||
private IBufferArrayGL vertexArray = null;
|
||||
private IVertexArrayGL vertexArray = null;
|
||||
private IBufferGL vertexBuffer = null;
|
||||
|
||||
private IBufferGL instancesBuffer = null;
|
||||
@ -80,7 +80,7 @@ public class ForwardAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
||||
});
|
||||
verts.flip();
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(vertexBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
|
||||
@ -143,7 +143,7 @@ public class ForwardAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
||||
EaglerDeferredPipeline.uniformMatrixHelper(shaderProgram.uniforms.u_inverseViewMatrix4f, DeferredStateManager.passInverseViewMatrix);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
int p = particleBuffer.position();
|
||||
int l = particleBuffer.limit();
|
||||
|
@ -20,7 +20,7 @@ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
|
||||
@ -46,7 +46,7 @@ public class GBufferAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
||||
|
||||
private PipelineShaderAccelParticleGBuffer shaderProgram = null;
|
||||
|
||||
private IBufferArrayGL vertexArray = null;
|
||||
private IVertexArrayGL vertexArray = null;
|
||||
private IBufferGL vertexBuffer = null;
|
||||
|
||||
private IBufferGL instancesBuffer = null;
|
||||
@ -80,7 +80,7 @@ public class GBufferAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
||||
});
|
||||
verts.flip();
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(vertexBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
|
||||
@ -142,7 +142,7 @@ public class GBufferAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
||||
EaglerDeferredPipeline.uniformMatrixHelper(shaderProgram.uniforms.u_matrixTransform, tmpMatrix);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
int p = particleBuffer.position();
|
||||
int l = particleBuffer.limit();
|
||||
|
@ -128,6 +128,9 @@ public class GBufferPipelineCompiler implements IExtPipelineCompiler {
|
||||
if(conf.is_rendering_useEnvMap) {
|
||||
macros.append("#define COMPILE_PARABOLOID_ENV_MAP\n");
|
||||
}
|
||||
if(conf.is_rendering_subsurfaceScattering) {
|
||||
macros.append("#define COMPILE_SUBSURFACE_SCATTERING\n");
|
||||
}
|
||||
}
|
||||
if(conf.is_rendering_dynamicLights) {
|
||||
macros.append("#define COMPILE_DYNAMIC_LIGHTS\n");
|
||||
@ -166,6 +169,9 @@ public class GBufferPipelineCompiler implements IExtPipelineCompiler {
|
||||
if((stateExtBits & STATE_WAVING_BLOCKS) != 0) {
|
||||
macros.append("#define COMPILE_STATE_WAVING_BLOCKS\n");
|
||||
}
|
||||
if(conf.is_rendering_subsurfaceScattering) {
|
||||
macros.append("#define COMPILE_SUBSURFACE_SCATTERING\n");
|
||||
}
|
||||
|
||||
logger.info("Compiling program for core state: {}, ext state: {}", visualizeBits(stateCoreBits), visualizeBits(stateExtBits));
|
||||
logger.info(" - {}", ShaderSource.deferred_core_vsh);
|
||||
@ -232,12 +238,24 @@ public class GBufferPipelineCompiler implements IExtPipelineCompiler {
|
||||
float roughness = 1.0f - DeferredStateManager.materialConstantsRoughness;
|
||||
float metalness = DeferredStateManager.materialConstantsMetalness;
|
||||
float emission = DeferredStateManager.materialConstantsEmission;
|
||||
if(uniforms.materialConstantsRoughness != roughness || uniforms.materialConstantsMetalness != metalness
|
||||
|| uniforms.materialConstantsEmission != emission) {
|
||||
uniforms.materialConstantsRoughness = roughness;
|
||||
uniforms.materialConstantsMetalness = metalness;
|
||||
uniforms.materialConstantsEmission = emission;
|
||||
_wglUniform3f(uniforms.u_materialConstants3f, roughness, metalness, emission);
|
||||
if(uniforms.u_materialConstants4f != null) {
|
||||
float subsurfScattering = 1.0f - DeferredStateManager.materialConstantsSubsurfScatting;
|
||||
if(uniforms.materialConstantsRoughness != roughness || uniforms.materialConstantsMetalness != metalness
|
||||
|| uniforms.materialConstantsEmission != emission || uniforms.materialConstantsSubsurfScattering != subsurfScattering) {
|
||||
uniforms.materialConstantsRoughness = roughness;
|
||||
uniforms.materialConstantsMetalness = metalness;
|
||||
uniforms.materialConstantsEmission = emission;
|
||||
uniforms.materialConstantsSubsurfScattering = subsurfScattering;
|
||||
_wglUniform4f(uniforms.u_materialConstants4f, roughness, metalness, emission, subsurfScattering);
|
||||
}
|
||||
}else {
|
||||
if(uniforms.materialConstantsRoughness != roughness || uniforms.materialConstantsMetalness != metalness
|
||||
|| uniforms.materialConstantsEmission != emission) {
|
||||
uniforms.materialConstantsRoughness = roughness;
|
||||
uniforms.materialConstantsMetalness = metalness;
|
||||
uniforms.materialConstantsEmission = emission;
|
||||
_wglUniform3f(uniforms.u_materialConstants3f, roughness, metalness, emission);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.DrawUtils;
|
||||
@ -43,10 +43,10 @@ public class LensFlareMeshRenderer {
|
||||
public static final ResourceLocation ghostsTextureLocation = new ResourceLocation("eagler:glsl/deferred/lens_ghosts.bmp");
|
||||
public static final int ghostsSpriteCount = 4;
|
||||
|
||||
static IBufferArrayGL streaksVertexArray = null;
|
||||
static IVertexArrayGL streaksVertexArray = null;
|
||||
static IBufferGL streaksVertexBuffer = null;
|
||||
|
||||
static IBufferArrayGL ghostsVertexArray = null;
|
||||
static IVertexArrayGL ghostsVertexArray = null;
|
||||
static IBufferGL ghostsVertexBuffer = null;
|
||||
|
||||
static PipelineShaderLensFlares streaksProgram = null;
|
||||
@ -88,7 +88,7 @@ public class LensFlareMeshRenderer {
|
||||
_wglBufferData(GL_ARRAY_BUFFER, copyBuffer, GL_STATIC_DRAW);
|
||||
|
||||
streaksVertexArray = _wglGenVertexArrays();
|
||||
EaglercraftGPU.bindGLBufferArray(streaksVertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(streaksVertexArray);
|
||||
EaglercraftGPU.attachQuad16EmulationBuffer(16, true);
|
||||
|
||||
_wglEnableVertexAttribArray(0);
|
||||
@ -133,7 +133,7 @@ public class LensFlareMeshRenderer {
|
||||
copyBuffer.flip();
|
||||
|
||||
ghostsVertexArray = _wglGenVertexArrays();
|
||||
EaglercraftGPU.bindGLBufferArray(ghostsVertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(ghostsVertexArray);
|
||||
EaglercraftGPU.bindGLArrayBuffer(DrawUtils.standardQuadVBO);
|
||||
|
||||
_wglEnableVertexAttribArray(0);
|
||||
@ -315,7 +315,7 @@ public class LensFlareMeshRenderer {
|
||||
mag = 0.003f * (1.0f + mag * mag * mag * 4.0f);
|
||||
_wglUniform3f(streaksProgram.uniforms.u_flareColor3f, v.x * mag * 0.5f, v.y * mag * 0.5f, v.z * mag * 0.5f);
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(streaksVertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(streaksVertexArray);
|
||||
_wglDrawElements(GL_TRIANGLES, streaksVertexCount + (streaksVertexCount >> 1), GL_UNSIGNED_SHORT, 0);
|
||||
|
||||
ghostsProgram.useProgram();
|
||||
@ -328,7 +328,7 @@ public class LensFlareMeshRenderer {
|
||||
_wglUniform2f(ghostsProgram.uniforms.u_sunPosition2f, sunScreenX, sunScreenY);
|
||||
_wglUniform1f(ghostsProgram.uniforms.u_baseScale1f, fov);
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(ghostsVertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(ghostsVertexArray);
|
||||
_wglDrawArraysInstanced(GL_TRIANGLES, 0, 6, ghostsInstanceCount);
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
|
@ -26,7 +26,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
@ -40,7 +40,7 @@ public class LightSourceMesh {
|
||||
|
||||
private IBufferGL meshVBO = null;
|
||||
private IBufferGL meshIBO = null;
|
||||
private IBufferArrayGL meshVAO = null;
|
||||
private IVertexArrayGL meshVAO = null;
|
||||
|
||||
private int meshIndexType = -1;
|
||||
private int meshIndexCount = -1;
|
||||
@ -102,7 +102,7 @@ public class LightSourceMesh {
|
||||
buf.flip();
|
||||
|
||||
meshVAO = _wglGenVertexArrays();
|
||||
EaglercraftGPU.bindGLBufferArray(meshVAO);
|
||||
EaglercraftGPU.bindGLVertexArray(meshVAO);
|
||||
|
||||
meshIBO = _wglGenBuffers();
|
||||
_wglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, meshIBO);
|
||||
@ -117,7 +117,7 @@ public class LightSourceMesh {
|
||||
}
|
||||
|
||||
public void drawMeshVAO() {
|
||||
EaglercraftGPU.bindGLBufferArray(meshVAO);
|
||||
EaglercraftGPU.bindGLVertexArray(meshVAO);
|
||||
_wglDrawElements(GL_TRIANGLES, meshIndexCount, meshIndexType, 0);
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ public class ShaderPackInfo {
|
||||
public final boolean POST_LENS_FLARES;
|
||||
public final boolean POST_BLOOM;
|
||||
public final boolean POST_FXAA;
|
||||
public final boolean SUBSURFACE_SCATTERING;
|
||||
|
||||
public ShaderPackInfo(JSONObject json) {
|
||||
name = json.optString("name", "Untitled");
|
||||
@ -75,6 +76,7 @@ public class ShaderPackInfo {
|
||||
POST_LENS_FLARES = supportedFeatures.contains("POST_LENS_FLARES");
|
||||
POST_BLOOM = supportedFeatures.contains("POST_BLOOM");
|
||||
POST_FXAA = supportedFeatures.contains("POST_FXAA");
|
||||
SUBSURFACE_SCATTERING = supportedFeatures.contains("SUBSURFACE_SCATTERING");
|
||||
}
|
||||
|
||||
}
|
@ -26,7 +26,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
@ -40,7 +40,7 @@ public class SkyboxRenderer {
|
||||
|
||||
private IBufferGL skyboxVBO = null;
|
||||
private IBufferGL skyboxIBO = null;
|
||||
private IBufferArrayGL skyboxVAO = null;
|
||||
private IVertexArrayGL skyboxVAO = null;
|
||||
private int normalsLUT = -1;
|
||||
private int atmosphereLUTWidth = -1;
|
||||
private int atmosphereLUTHeight = -1;
|
||||
@ -136,7 +136,7 @@ public class SkyboxRenderer {
|
||||
buf.flip();
|
||||
|
||||
skyboxVAO = _wglGenVertexArrays();
|
||||
EaglercraftGPU.bindGLBufferArray(skyboxVAO);
|
||||
EaglercraftGPU.bindGLVertexArray(skyboxVAO);
|
||||
|
||||
skyboxIBO = _wglGenBuffers();
|
||||
_wglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, skyboxIBO);
|
||||
@ -166,17 +166,17 @@ public class SkyboxRenderer {
|
||||
}
|
||||
|
||||
public void drawTop() {
|
||||
EaglercraftGPU.bindGLBufferArray(skyboxVAO);
|
||||
EaglercraftGPU.bindGLVertexArray(skyboxVAO);
|
||||
_wglDrawElements(GL_TRIANGLES, skyboxTopIndexCount, skyboxIndexType, skyboxTopIndexOffset * skyboxIndexStride);
|
||||
}
|
||||
|
||||
public void drawBottom() {
|
||||
EaglercraftGPU.bindGLBufferArray(skyboxVAO);
|
||||
EaglercraftGPU.bindGLVertexArray(skyboxVAO);
|
||||
_wglDrawElements(GL_TRIANGLES, skyboxBottomIndexCount, skyboxIndexType, skyboxBottomIndexOffset * skyboxIndexStride);
|
||||
}
|
||||
|
||||
public void drawFull() {
|
||||
EaglercraftGPU.bindGLBufferArray(skyboxVAO);
|
||||
EaglercraftGPU.bindGLVertexArray(skyboxVAO);
|
||||
_wglDrawElements(GL_TRIANGLES, skyboxIndexCount, skyboxIndexType, 0);
|
||||
}
|
||||
|
||||
|
@ -217,6 +217,23 @@ public class GuiShaderConfigList extends GuiListExtended {
|
||||
}
|
||||
});
|
||||
}
|
||||
if(conf.shaderPackInfo.SUBSURFACE_SCATTERING) {
|
||||
opts.add(new ShaderOption(loadShaderLbl("SUBSURFACE_SCATTERING"), loadShaderDesc("SUBSURFACE_SCATTERING")) {
|
||||
private final boolean originalValue = conf.subsurfaceScattering;
|
||||
@Override
|
||||
protected String getDisplayValue() {
|
||||
return getColoredOnOff(conf.subsurfaceScattering, EnumChatFormatting.GREEN, EnumChatFormatting.RED);
|
||||
}
|
||||
@Override
|
||||
protected void toggleOption(GuiButton button, int dir) {
|
||||
conf.subsurfaceScattering = !conf.subsurfaceScattering;
|
||||
}
|
||||
@Override
|
||||
protected boolean getDirty() {
|
||||
return conf.subsurfaceScattering != originalValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
if(conf.shaderPackInfo.POST_LENS_FLARES) {
|
||||
opts.add(new ShaderOption(loadShaderLbl("POST_LENS_FLARES"), loadShaderDesc("POST_LENS_FLARES")) {
|
||||
private final boolean originalValue = conf.lensFlares;
|
||||
|
@ -39,9 +39,11 @@ public class GBufferExtPipelineShader extends ShaderProgram<GBufferExtPipelineSh
|
||||
public float materialConstantsRoughness = -999.0f;
|
||||
public float materialConstantsMetalness = -999.0f;
|
||||
public float materialConstantsEmission = -999.0f;
|
||||
public float materialConstantsSubsurfScattering = -999.0f;
|
||||
public float materialConstantsUseEnvMap = -999.0f;
|
||||
|
||||
public IUniformGL u_materialConstants3f = null;
|
||||
public IUniformGL u_materialConstants4f = null;
|
||||
public IUniformGL u_useEnvMap1f = null;
|
||||
|
||||
public int constantBlock = -999;
|
||||
@ -91,6 +93,7 @@ public class GBufferExtPipelineShader extends ShaderProgram<GBufferExtPipelineSh
|
||||
@Override
|
||||
public void loadUniforms(IProgramGL prog) {
|
||||
u_materialConstants3f = _wglGetUniformLocation(prog, "u_materialConstants3f");
|
||||
u_materialConstants4f = _wglGetUniformLocation(prog, "u_materialConstants4f");
|
||||
u_useEnvMap1f = _wglGetUniformLocation(prog, "u_useEnvMap1f");
|
||||
u_blockConstant1f = _wglGetUniformLocation(prog, "u_blockConstant1f");
|
||||
u_clipPlaneY1f = _wglGetUniformLocation(prog, "u_clipPlaneY1f");
|
||||
|
@ -80,6 +80,7 @@ public class PipelineShaderGBufferFog extends ShaderProgram<PipelineShaderGBuffe
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_fogDepthTexture"), 2);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_environmentMap"), 3);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_lightShaftsTexture"), 4);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_skyTexture"), 5);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,20 +28,28 @@ import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
|
||||
|
||||
public class PipelineShaderLightingSun extends ShaderProgram<PipelineShaderLightingSun.Uniforms> {
|
||||
|
||||
public static PipelineShaderLightingSun compile(int shadowsSun, boolean coloredShadows) throws ShaderException {
|
||||
public static PipelineShaderLightingSun compile(int shadowsSun, boolean coloredShadows, boolean subsurfaceScattering) throws ShaderException {
|
||||
IShaderGL sunShader = null;
|
||||
List<String> compileFlags = new ArrayList<>(1);
|
||||
if(shadowsSun > 0) {
|
||||
compileFlags.add("COMPILE_SUN_SHADOW");
|
||||
}
|
||||
int lods = shadowsSun - 1;
|
||||
if(lods > 2) {
|
||||
lods = 2;
|
||||
}
|
||||
compileFlags.add("COMPILE_SUN_SHADOW_LOD" + lods);
|
||||
if(coloredShadows) {
|
||||
compileFlags.add("COMPILE_COLORED_SHADOW");
|
||||
}
|
||||
if(subsurfaceScattering) {
|
||||
compileFlags.add("COMPILE_SUBSURFACE_SCATTERING");
|
||||
}
|
||||
sunShader = ShaderCompiler.compileShader("lighting_sun", GL_FRAGMENT_SHADER,
|
||||
ShaderSource.lighting_sun_fsh, compileFlags);
|
||||
try {
|
||||
IProgramGL prog = ShaderCompiler.linkProgram("lighting_sun", SharedPipelineShaders.deferred_local, sunShader);
|
||||
return new PipelineShaderLightingSun(prog, shadowsSun);
|
||||
return new PipelineShaderLightingSun(prog, shadowsSun, subsurfaceScattering);
|
||||
}finally {
|
||||
if(sunShader != null) {
|
||||
sunShader.free();
|
||||
@ -49,20 +57,23 @@ public class PipelineShaderLightingSun extends ShaderProgram<PipelineShaderLight
|
||||
}
|
||||
}
|
||||
|
||||
private PipelineShaderLightingSun(IProgramGL program, int shadowsSun) {
|
||||
super(program, new Uniforms(shadowsSun));
|
||||
private PipelineShaderLightingSun(IProgramGL program, int shadowsSun, boolean subsurfaceScattering) {
|
||||
super(program, new Uniforms(shadowsSun, subsurfaceScattering));
|
||||
}
|
||||
|
||||
public static class Uniforms implements IProgramUniforms {
|
||||
|
||||
public final int shadowsSun;
|
||||
public IUniformGL u_inverseViewMatrix4f;
|
||||
public IUniformGL u_inverseProjectionMatrix4f;
|
||||
public IUniformGL u_sunDirection3f;
|
||||
public IUniformGL u_sunColor3f;
|
||||
|
||||
private Uniforms(int shadowsSun) {
|
||||
public final int shadowsSun;
|
||||
public final boolean subsurfaceScattering;
|
||||
|
||||
private Uniforms(int shadowsSun, boolean subsurfaceScattering) {
|
||||
this.shadowsSun = shadowsSun;
|
||||
this.subsurfaceScattering = subsurfaceScattering;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -73,6 +84,7 @@ public class PipelineShaderLightingSun extends ShaderProgram<PipelineShaderLight
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_gbufferDepthTexture"), 3);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_sunShadowTexture"), 4);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_metalsLUT"), 5);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_subsurfaceScatteringTexture"), 6);
|
||||
u_inverseViewMatrix4f = _wglGetUniformLocation(prog, "u_inverseViewMatrix4f");
|
||||
u_inverseProjectionMatrix4f = _wglGetUniformLocation(prog, "u_inverseProjectionMatrix4f");
|
||||
u_sunDirection3f = _wglGetUniformLocation(prog, "u_sunDirection3f");
|
||||
|
@ -84,6 +84,7 @@ public class PipelineShaderSkyboxRender extends ShaderProgram<PipelineShaderSkyb
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_renderedAtmosphere"), 0);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_cloudsTexture"), 1);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_sunOcclusion"), 2);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_gbufferDepthTexture"), 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2025 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL._wglGetUniformLocation;
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL._wglUniform1i;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
|
||||
|
||||
public class PipelineShaderSubsurfaceScattering extends ShaderProgram<PipelineShaderSubsurfaceScattering.Uniforms> {
|
||||
|
||||
public static PipelineShaderSubsurfaceScattering compile(int shadowsSun, float texW, float texH) throws ShaderException {
|
||||
IShaderGL shadowShader = null;
|
||||
List<String> compileFlags = new ArrayList<>(3);
|
||||
if(shadowsSun == 0) {
|
||||
throw new IllegalStateException("Enable shadows to compile this shader");
|
||||
}
|
||||
int lods = shadowsSun - 1;
|
||||
if(lods > 2) {
|
||||
lods = 2;
|
||||
}
|
||||
compileFlags.add("COMPILE_SUN_SHADOW_LOD" + lods);
|
||||
compileFlags.add("SUN_SHADOW_DEPTH_SIZE_2F_X " + texW);
|
||||
compileFlags.add("SUN_SHADOW_DEPTH_SIZE_2F_Y " + texH);
|
||||
shadowShader = ShaderCompiler.compileShader("subsurface_scattering", GL_FRAGMENT_SHADER,
|
||||
ShaderSource.subsurface_scattering_fsh, compileFlags);
|
||||
try {
|
||||
IProgramGL prog = ShaderCompiler.linkProgram("subsurface_scattering", SharedPipelineShaders.deferred_local, shadowShader);
|
||||
return new PipelineShaderSubsurfaceScattering(prog, shadowsSun, texW, texH);
|
||||
}finally {
|
||||
if(shadowShader != null) {
|
||||
shadowShader.free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private PipelineShaderSubsurfaceScattering(IProgramGL program, int shadowsSun, float texW, float texH) {
|
||||
super(program, new Uniforms(shadowsSun, texW, texH));
|
||||
}
|
||||
|
||||
public static class Uniforms implements IProgramUniforms {
|
||||
|
||||
public final int shadowsSun;
|
||||
public final float texW;
|
||||
public final float texH;
|
||||
public IUniformGL u_inverseViewMatrix4f;
|
||||
public IUniformGL u_inverseViewProjMatrix4f;
|
||||
public IUniformGL u_sunShadowMatrixLOD04f;
|
||||
public IUniformGL u_sunShadowMatrixLOD14f;
|
||||
public IUniformGL u_sunShadowMatrixLOD24f;
|
||||
public IUniformGL u_sunDirection3f;
|
||||
|
||||
private Uniforms(int shadowsSun, float texW, float texH) {
|
||||
this.shadowsSun = shadowsSun;
|
||||
this.texW = texW;
|
||||
this.texH = texH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUniforms(IProgramGL prog) {
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_gbufferNormalTexture"), 0);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_gbufferDepthTexture"), 1);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_gbufferMaterialTexture"), 2);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_sunShadowDepthTexture"), 3);
|
||||
u_inverseViewMatrix4f = _wglGetUniformLocation(prog, "u_inverseViewMatrix4f");
|
||||
u_inverseViewProjMatrix4f = _wglGetUniformLocation(prog, "u_inverseViewProjMatrix4f");
|
||||
u_sunShadowMatrixLOD04f = _wglGetUniformLocation(prog, "u_sunShadowMatrixLOD04f");
|
||||
u_sunShadowMatrixLOD14f = _wglGetUniformLocation(prog, "u_sunShadowMatrixLOD14f");
|
||||
u_sunShadowMatrixLOD24f = _wglGetUniformLocation(prog, "u_sunShadowMatrixLOD24f");
|
||||
u_sunDirection3f = _wglGetUniformLocation(prog, "u_sunDirection3f");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -93,6 +93,7 @@ public class ShaderSource {
|
||||
public static final ResourceLocation reproject_ssr_fsh = new ResourceLocation("eagler:glsl/deferred/reproject_ssr.fsh");
|
||||
public static final ResourceLocation post_fxaa_fsh = new ResourceLocation("eagler:glsl/deferred/post_fxaa.fsh");
|
||||
public static final ResourceLocation hand_depth_mask_fsh = new ResourceLocation("eagler:glsl/deferred/hand_depth_mask.fsh");
|
||||
public static final ResourceLocation subsurface_scattering_fsh = new ResourceLocation("eagler:glsl/deferred/subsurface_scattering.fsh");
|
||||
|
||||
public static final ResourceLocation core_dynamiclights_vsh = new ResourceLocation("eagler:glsl/dynamiclights/core_dynamiclights.vsh");
|
||||
public static final ResourceLocation core_dynamiclights_fsh = new ResourceLocation("eagler:glsl/dynamiclights/core_dynamiclights.fsh");
|
||||
|
@ -37,7 +37,7 @@ public class PBRMaterialConstants implements IResourceManagerReloadListener {
|
||||
public final ResourceLocation resourceLocation;
|
||||
public final Map<String,Integer> spriteNameToMaterialConstants = new HashMap<>();
|
||||
|
||||
public int defaultMaterial = 0x00000A77;
|
||||
public int defaultMaterial = 0xFF000A77;
|
||||
|
||||
public PBRMaterialConstants(ResourceLocation resourceLocation) {
|
||||
this.resourceLocation = resourceLocation;
|
||||
@ -59,9 +59,14 @@ public class PBRMaterialConstants implements IResourceManagerReloadListener {
|
||||
continue;
|
||||
}
|
||||
String[] cols = line.split(",");
|
||||
if(cols.length == 4) {
|
||||
if(cols.length == 4 || cols.length == 5) {
|
||||
try {
|
||||
int value = Integer.parseInt(cols[1]) | (Integer.parseInt(cols[2]) << 8) | (Integer.parseInt(cols[3]) << 16);
|
||||
if(cols.length == 5) {
|
||||
value |= ((255 - Integer.parseInt(cols[4])) << 24);
|
||||
}else {
|
||||
value |= 0xFF000000;
|
||||
}
|
||||
if(cols[0].equals("default")) {
|
||||
defaultMaterial = value;
|
||||
}else {
|
||||
|
@ -20,7 +20,7 @@ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
|
||||
@ -49,7 +49,7 @@ public class DynamicLightsAcceleratedEffectRenderer extends AbstractAcceleratedE
|
||||
|
||||
private DynamicLightsAccelParticleShader shaderProgram = null;
|
||||
|
||||
private IBufferArrayGL vertexArray = null;
|
||||
private IVertexArrayGL vertexArray = null;
|
||||
private IBufferGL vertexBuffer = null;
|
||||
|
||||
private IBufferGL instancesBuffer = null;
|
||||
@ -85,7 +85,7 @@ public class DynamicLightsAcceleratedEffectRenderer extends AbstractAcceleratedE
|
||||
});
|
||||
verts.flip();
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(vertexBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
|
||||
@ -149,7 +149,7 @@ public class DynamicLightsAcceleratedEffectRenderer extends AbstractAcceleratedE
|
||||
_wglUniformMatrix4fv(shaderProgram.uniforms.u_inverseViewMatrix4f, false, buf);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
EaglercraftGPU.bindGLVertexArray(vertexArray);
|
||||
|
||||
int p = particleBuffer.position();
|
||||
int l = particleBuffer.limit();
|
||||
|
@ -44,7 +44,7 @@ public class DynamicLightsStateManager {
|
||||
static int lastTotal = 0;
|
||||
private static long lastTick = 0l;
|
||||
|
||||
public static final void enableDynamicLightsRender() {
|
||||
public static void enableDynamicLightsRender() {
|
||||
if(bucketLoader == null) {
|
||||
bucketLoader = new DynamicLightBucketLoader();
|
||||
bucketLoader.initialize();
|
||||
@ -60,11 +60,11 @@ public class DynamicLightsStateManager {
|
||||
maxListLengthTracker = 0;
|
||||
}
|
||||
|
||||
public static final void bindAcceleratedEffectRenderer(EffectRenderer renderer) {
|
||||
public static void bindAcceleratedEffectRenderer(EffectRenderer renderer) {
|
||||
renderer.acceleratedParticleRenderer = accelParticleRenderer;
|
||||
}
|
||||
|
||||
public static final void disableDynamicLightsRender(boolean unloadPipeline) {
|
||||
public static void disableDynamicLightsRender(boolean unloadPipeline) {
|
||||
if(bucketLoader != null) {
|
||||
bucketLoader.destroy();
|
||||
bucketLoader = null;
|
||||
@ -82,21 +82,21 @@ public class DynamicLightsStateManager {
|
||||
maxListLengthTracker = 0;
|
||||
}
|
||||
|
||||
public static final boolean isDynamicLightsRender() {
|
||||
public static boolean isDynamicLightsRender() {
|
||||
return bucketLoader != null;
|
||||
}
|
||||
|
||||
public static final boolean isInDynamicLightsPass() {
|
||||
public static boolean isInDynamicLightsPass() {
|
||||
return GlStateManager.isExtensionPipeline() && bucketLoader != null;
|
||||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition(int centerX, int centerY, int centerZ) {
|
||||
public static void reportForwardRenderObjectPosition(int centerX, int centerY, int centerZ) {
|
||||
if(bucketLoader != null) {
|
||||
bucketLoader.bindLightSourceBucket(centerX, centerY, centerZ, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition2(float x, float y, float z) {
|
||||
public static void reportForwardRenderObjectPosition2(float x, float y, float z) {
|
||||
if(bucketLoader != null) {
|
||||
float posX = (float)((x + TileEntityRendererDispatcher.staticPlayerX) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerX / 16.0) << 4));
|
||||
float posY = (float)((y + TileEntityRendererDispatcher.staticPlayerY) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerY / 16.0) << 4));
|
||||
@ -105,7 +105,7 @@ public class DynamicLightsStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void renderDynamicLight(String lightName, double posX, double posY, double posZ, float radius) {
|
||||
public static void renderDynamicLight(String lightName, double posX, double posY, double posZ, float radius) {
|
||||
if(bucketLoader != null) {
|
||||
DynamicLightInstance dl;
|
||||
if(instancePoolIndex < lightInstancePool.size()) {
|
||||
@ -119,7 +119,7 @@ public class DynamicLightsStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void clearRenderList() {
|
||||
public static void clearRenderList() {
|
||||
if(instancePoolIndex > maxListLengthTracker) {
|
||||
maxListLengthTracker = instancePoolIndex;
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class DynamicLightsStateManager {
|
||||
instancePoolIndex = 0;
|
||||
}
|
||||
|
||||
public static final void commitLightSourceBuckets(double renderPosX, double renderPosY, double renderPosZ) {
|
||||
public static void commitLightSourceBuckets(double renderPosX, double renderPosY, double renderPosZ) {
|
||||
lastTotal = lightRenderList.size();
|
||||
if(bucketLoader != null) {
|
||||
bucketLoader.clearBuckets();
|
||||
@ -149,12 +149,12 @@ public class DynamicLightsStateManager {
|
||||
clearRenderList();
|
||||
}
|
||||
|
||||
public static final void setupInverseViewMatrix() {
|
||||
public static void setupInverseViewMatrix() {
|
||||
Matrix4f.invert(GlStateManager.getModelViewReference(), inverseViewMatrix);
|
||||
inverseViewMatrixSerial = GlStateManager.getModelViewSerial();
|
||||
}
|
||||
|
||||
private static final void updateTimers() {
|
||||
private static void updateTimers() {
|
||||
long millis = EagRuntime.steadyTimeMillis();
|
||||
if(millis - lastTick > 5000l) {
|
||||
lastTick = millis;
|
||||
@ -169,7 +169,7 @@ public class DynamicLightsStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void destroyAll() {
|
||||
public static void destroyAll() {
|
||||
lightInstancePool = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.ArrayUtils;
|
||||
import net.lax1dude.eaglercraft.v1_8.ClientUUIDLoadingCache;
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
||||
@ -83,6 +84,7 @@ public class ConnectionHandshake {
|
||||
try {
|
||||
EaglerProfile.clearServerSkinOverride();
|
||||
PauseMenuCustomizeState.reset();
|
||||
ClientUUIDLoadingCache.resetFlags();
|
||||
pluginVersion = null;
|
||||
pluginBrand = null;
|
||||
protocolVersion = -1;
|
||||
|
@ -19,6 +19,7 @@ package net.lax1dude.eaglercraft.v1_8.sp.ipc;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class IPCPacket15Crashed implements IPCPacketBase {
|
||||
|
||||
@ -35,12 +36,17 @@ public class IPCPacket15Crashed implements IPCPacketBase {
|
||||
|
||||
@Override
|
||||
public void deserialize(DataInput bin) throws IOException {
|
||||
crashReport = bin.readUTF();
|
||||
int len = bin.readInt();
|
||||
byte[] bytes = new byte[len];
|
||||
bin.readFully(bytes);
|
||||
crashReport = new String(bytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(DataOutput bin) throws IOException {
|
||||
bin.writeUTF(crashReport);
|
||||
byte[] bytes = crashReport.getBytes(StandardCharsets.UTF_8);
|
||||
bin.writeInt(bytes.length);
|
||||
bin.write(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,7 +56,7 @@ public class IPCPacket15Crashed implements IPCPacketBase {
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return IPCPacketBase.strLen(crashReport);
|
||||
return IPCPacketBase.strLen(crashReport) + 2;
|
||||
}
|
||||
|
||||
}
|
@ -66,6 +66,7 @@ public class RelayQueryImpl implements RelayQuery {
|
||||
try {
|
||||
connectionOpenedAt = EagRuntime.steadyTimeMillis();
|
||||
s = PlatformNetworking.openWebSocketUnsafe(uri);
|
||||
s.setEnableStringFrames(false);
|
||||
}catch(Throwable t) {
|
||||
connectionOpenedAt = 0l;
|
||||
sock = null;
|
||||
@ -79,10 +80,6 @@ public class RelayQueryImpl implements RelayQuery {
|
||||
@Override
|
||||
public void update() {
|
||||
if(sock == null) return;
|
||||
if(sock.availableStringFrames() > 0) {
|
||||
logger.warn("[{}] discarding {} string frames recieved on a binary connection", uri, sock.availableStringFrames());
|
||||
sock.clearStringFrames();
|
||||
}
|
||||
List<IWebSocketFrame> frames = sock.getNextBinaryFrames();
|
||||
if(frames != null) {
|
||||
for(int i = 0, l = frames.size(); i < l; ++i) {
|
||||
|
@ -51,6 +51,7 @@ public class RelayServerSocketImpl implements RelayServerSocket {
|
||||
IWebSocketClient s;
|
||||
try {
|
||||
s = PlatformNetworking.openWebSocketUnsafe(uri);
|
||||
s.setEnableStringFrames(false);
|
||||
}catch(Throwable t) {
|
||||
exceptions.add(t);
|
||||
sock = null;
|
||||
@ -63,10 +64,6 @@ public class RelayServerSocketImpl implements RelayServerSocket {
|
||||
@Override
|
||||
public void update() {
|
||||
if(sock == null) return;
|
||||
if(sock.availableStringFrames() > 0) {
|
||||
logger.warn("[{}] discarding {} string frames recieved on a binary connection", uri, sock.availableStringFrames());
|
||||
sock.clearStringFrames();
|
||||
}
|
||||
List<IWebSocketFrame> frames = sock.getNextBinaryFrames();
|
||||
if(frames != null) {
|
||||
for(int i = 0, l = frames.size(); i < l; ++i) {
|
||||
|
@ -62,6 +62,7 @@ public class RelayWorldsQueryImpl implements RelayWorldsQuery {
|
||||
try {
|
||||
openedAt = EagRuntime.steadyTimeMillis();
|
||||
s = PlatformNetworking.openWebSocketUnsafe(uri);
|
||||
s.setEnableStringFrames(false);
|
||||
}catch(Throwable t) {
|
||||
sock = null;
|
||||
failed = true;
|
||||
@ -73,10 +74,6 @@ public class RelayWorldsQueryImpl implements RelayWorldsQuery {
|
||||
@Override
|
||||
public void update() {
|
||||
if(sock == null) return;
|
||||
if(sock.availableStringFrames() > 0) {
|
||||
logger.warn("[{}] discarding {} string frames recieved on a binary connection", uri, sock.availableStringFrames());
|
||||
sock.clearStringFrames();
|
||||
}
|
||||
List<IWebSocketFrame> frames = sock.getNextBinaryFrames();
|
||||
if(frames != null) {
|
||||
for(int i = 0, l = frames.size(); i < l; ++i) {
|
||||
|
@ -87,7 +87,8 @@ public class EaglerIntegratedServerWorker {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ServerPlatformSingleplayer.isTabAboutToCloseWASM() && !isServerStopped()) {
|
||||
if (!ServerPlatformSingleplayer.isSingleThreadMode() && ServerPlatformSingleplayer.isTabAboutToCloseWASM()
|
||||
&& !isServerStopped()) {
|
||||
logger.info("Autosaving worlds because the tab is about to close!");
|
||||
currentProcess.getConfigurationManager().saveAllPlayerData();
|
||||
currentProcess.saveAllWorlds(false);
|
||||
|
@ -65,15 +65,15 @@ public class Config {
|
||||
}
|
||||
|
||||
public static boolean isTreesFancy() {
|
||||
return gameSettings.fancyGraphics;
|
||||
return gameSettings.fancyGraphics || gameSettings.shaders;
|
||||
}
|
||||
|
||||
public static boolean isTreesSmart() {
|
||||
return gameSettings.fancyGraphics && gameSettings.smartLeavesOF;
|
||||
return (gameSettings.fancyGraphics || gameSettings.shaders) && gameSettings.smartLeavesOF;
|
||||
}
|
||||
|
||||
public static boolean isCullFacesLeaves() {
|
||||
return !gameSettings.fancyGraphics;
|
||||
return !gameSettings.fancyGraphics || gameSettings.shaders;
|
||||
}
|
||||
|
||||
public static boolean isCustomItems() {
|
||||
|
@ -1 +1 @@
|
||||
u49
|
||||
u50
|
@ -83,6 +83,7 @@ uniform sampler2D u_metalsLUT;
|
||||
#define LIB_INCLUDE_PBR_LIGHTING_FUNCTION
|
||||
#define LIB_INCLUDE_PBR_LIGHTING_PREFETCH
|
||||
#EAGLER INCLUDE (3) "eagler:glsl/deferred/lib/pbr_lighting.glsl"
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/branchless_comparison.glsl"
|
||||
|
||||
uniform sampler2D u_irradianceMap;
|
||||
|
||||
@ -139,14 +140,14 @@ void main() {
|
||||
float skyLight = max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
|
||||
float shadowSample = 1.0;
|
||||
vec4 shadowWorldPos4f = worldPosition4f;
|
||||
shadowWorldPos4f.xyz += normalVector3f * 0.05;
|
||||
shadowWorldPos4f.xyz += normalVector3f * 0.1;
|
||||
|
||||
vec4 shadowTexPos4f;
|
||||
vec2 tmpVec2;
|
||||
for(;;) {
|
||||
shadowTexPos4f = u_sunShadowMatrixLOD04f * shadowWorldPos4f;
|
||||
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
|
||||
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z), 0.0);
|
||||
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z + 0.0001), 0.0);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -175,7 +176,7 @@ void main() {
|
||||
#ifdef DO_COMPILE_SUN_SHADOWS
|
||||
lightColor3f *= shadowSample * skyLight;
|
||||
#endif
|
||||
vec3 normalWrap3f = normalVector3f * (dot(-worldDirection4f.xyz, normalVector3f) < 0.0 ? -1.0 : 1.0);
|
||||
vec3 normalWrap3f = normalVector3f * COMPARE_LT_C_C(dot(-worldDirection4f.xyz, normalVector3f), 0.0, -1.0, 1.0);
|
||||
lightColor3f = eaglercraftLighting(diffuseColor4f.rgb, lightColor3f, -worldDirection4f.xyz, u_sunDirection4f.xyz, normalWrap3f, materialData3f, metalN, metalK) * u_blockSkySunDynamicLightFac4f.z;
|
||||
}
|
||||
|
||||
@ -194,8 +195,8 @@ void main() {
|
||||
vec4 sample2 = textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
|
||||
skyLight += mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, irradianceMapSamplePos2f.y * -12.5 + 0.5)).rgb;
|
||||
}else {
|
||||
irradianceMapSamplePos2f.xz *= vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : -0.25);
|
||||
irradianceMapSamplePos2f.xz += vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : 0.75);
|
||||
irradianceMapSamplePos2f.xz *= vec2(0.5, COMPARE_GT_C_C(irradianceMapSamplePos2f.y, 0.0, 0.25, -0.25));
|
||||
irradianceMapSamplePos2f.xz += vec2(0.5, COMPARE_GT_C_C(irradianceMapSamplePos2f.y, 0.0, 0.25, 0.75));
|
||||
skyLight += textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz, 0.0).rgb;
|
||||
}
|
||||
skyLight *= lightmapCoords2f.g * u_sunColor3f_sky1f.w;
|
||||
@ -210,7 +211,7 @@ void main() {
|
||||
for(int i = 0; i < safeLightCount; ++i) {
|
||||
dlightDist3f = worldPosition4f.xyz - u_dynamicLightArray[i].u_lightPosition4f.xyz;
|
||||
dlightDir3f = normalize(dlightDist3f);
|
||||
dlightDir3f = dlightDir3f * (dot(dlightDir3f, normalVector3f) < 0.0 ? 1.0 : -1.0);
|
||||
dlightDir3f = dlightDir3f * COMPARE_LT_C_C(dot(dlightDir3f, normalVector3f), 0.0, 1.0, -1.0);
|
||||
dlightDir3f = materialData3f.b == 1.0 ? normalVector3f : -dlightDir3f;
|
||||
if(dot(dlightDir3f, normalVector3f) <= 0.0) {
|
||||
continue;
|
||||
|
@ -40,5 +40,6 @@ void main() {
|
||||
}
|
||||
gbufferColor4f = vec4(diffuseRGBA.rgb, v_lightmap2f.r);
|
||||
gbufferNormal4f = vec4(0.5, 0.5, 1.0, v_lightmap2f.g);
|
||||
gbufferMaterial4f = vec4(texture(u_samplerNormalMaterial, vec2(v_texCoord2f.x, v_texCoord2f.y * u_textureYScale2f.x + u_textureYScale2f.y)).rgb, 1.0);
|
||||
gbufferMaterial4f = texture(u_samplerNormalMaterial, vec2(v_texCoord2f.x, v_texCoord2f.y * u_textureYScale2f.x + u_textureYScale2f.y));
|
||||
gbufferMaterial4f.a = 0.502 - gbufferMaterial4f.a * 0.502;
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -60,6 +60,7 @@ uniform float u_skyLightFactor1f;
|
||||
#endif
|
||||
|
||||
#EAGLER INCLUDE (3) "eagler:glsl/deferred/lib/pbr_env_map.glsl"
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/branchless_comparison.glsl"
|
||||
|
||||
void main() {
|
||||
vec3 diffuseColor3f;
|
||||
@ -86,7 +87,7 @@ void main() {
|
||||
|
||||
#ifdef COMPILE_GLOBAL_AMBIENT_OCCLUSION
|
||||
vec4 ao = textureLod(u_ssaoTexture, min(v_position2f * u_halfResolutionPixelAlignment2f, 1.0), 0.0);
|
||||
ao.g = ao.b > 0.0 ? ao.g : 1.0;
|
||||
ao.g = mix(COMPARE_GT_0_1(0.0, ao.b), 1.0, ao.g);
|
||||
shadow = mix(shadow, shadow * ao.g, 0.9);
|
||||
#endif
|
||||
|
||||
@ -102,8 +103,8 @@ void main() {
|
||||
vec4 sample2 = textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
|
||||
skyLight += mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, irradianceMapSamplePos2f.y * -12.5 + 0.5)).rgb;
|
||||
}else {
|
||||
irradianceMapSamplePos2f.xz *= vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : -0.25);
|
||||
irradianceMapSamplePos2f.xz += vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : 0.75);
|
||||
irradianceMapSamplePos2f.xz *= vec2(0.5, COMPARE_GT_C_C(irradianceMapSamplePos2f.y, 0.0, 0.25, -0.25));
|
||||
irradianceMapSamplePos2f.xz += vec2(0.5, COMPARE_GT_C_C(irradianceMapSamplePos2f.y, 0.0, 0.25, 0.75));
|
||||
skyLight += textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz, 0.0).rgb;
|
||||
}
|
||||
|
||||
@ -114,8 +115,8 @@ void main() {
|
||||
vec3 specular = vec3(0.0);
|
||||
|
||||
#ifdef COMPILE_ENV_MAP_REFLECTIONS
|
||||
float f = materialData4f.g < 0.06 ? 1.0 : 0.0;
|
||||
f += materialData4f.r < 0.5 ? 1.0 : 0.0;
|
||||
float f = COMPARE_LT_0_ANY(materialData4f.g, 0.06);
|
||||
f += COMPARE_LT_0_ANY(materialData4f.r, 0.5);
|
||||
while((materialData4f.a >= 0.5 ? f : -1.0) == 0.0) {
|
||||
vec4 worldPosition4f = vec4(v_position2f, depth, 1.0) * 2.0 - 1.0;
|
||||
worldPosition4f = u_inverseProjMatrix4f * worldPosition4f;
|
||||
@ -137,8 +138,8 @@ void main() {
|
||||
vec4 sample2 = textureLod(u_environmentMap, reflectDir.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
|
||||
envMapSample4f = vec4(mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, reflectDir.y * -12.5 + 0.5)).rgb, min(sample1.a, sample2.a));
|
||||
}else {
|
||||
reflectDir.xz = reflectDir.xz * vec2(0.5, reflectDir.y > 0.0 ? 0.25 : -0.25);
|
||||
reflectDir.xz += vec2(0.5, reflectDir.y > 0.0 ? 0.25 : 0.75);
|
||||
reflectDir.xz = reflectDir.xz * vec2(0.5, COMPARE_GT_C_C(reflectDir.y, 0.0, 0.25, -0.25));
|
||||
reflectDir.xz += vec2(0.5, COMPARE_GT_C_C(reflectDir.y, 0.0, 0.25, 0.75));
|
||||
envMapSample4f = textureLod(u_environmentMap, reflectDir.xz, 0.0);
|
||||
}
|
||||
envMapSample4f.a += min(lightmapCoords2f.g * 2.0, 1.0) * (1.0 - envMapSample4f.a);
|
||||
@ -152,8 +153,8 @@ void main() {
|
||||
|
||||
#ifdef COMPILE_SCREEN_SPACE_REFLECTIONS
|
||||
#ifndef COMPILE_ENV_MAP_REFLECTIONS
|
||||
float f = materialData4f.g < 0.06 ? 1.0 : 0.0;
|
||||
f += materialData4f.r < 0.5 ? 1.0 : 0.0;
|
||||
float f = COMPARE_LT_0_ANY(materialData4f.g, 0.06);
|
||||
f += COMPARE_LT_0_ANY(materialData4f.r, 0.5);
|
||||
if(f == 0.0) {
|
||||
#else
|
||||
if((materialData4f.a < 0.5 ? f : -1.0) == 0.0) {
|
||||
|
@ -73,8 +73,12 @@ in vec3 v_viewdir3f;
|
||||
uniform vec2 u_textureCoords01;
|
||||
#endif
|
||||
#else
|
||||
#ifdef COMPILE_SUBSURFACE_SCATTERING
|
||||
uniform vec4 u_materialConstants4f;
|
||||
#else
|
||||
uniform vec3 u_materialConstants3f;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_NORMAL_MATERIAL_TEXTURE
|
||||
mat3 cotangent_frame(in vec3 N, in vec3 p, in vec2 uv) {
|
||||
@ -155,14 +159,21 @@ void main() {
|
||||
normal = cf * vec3(normal2, sqrt(1.0 - dot(normal2, normal2)));
|
||||
}
|
||||
uv2.y += 0.5;
|
||||
vec3 material = texture(u_samplerNormalMaterial, uv2).rgb;
|
||||
vec4 material = texture(u_samplerNormalMaterial, uv2);
|
||||
#else
|
||||
vec3 material = u_materialConstants3f;
|
||||
#ifdef COMPILE_SUBSURFACE_SCATTERING
|
||||
vec4 material = u_materialConstants4f;
|
||||
#else
|
||||
vec4 material = vec4(u_materialConstants3f, 1.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
material.a = 1.0 - material.a + u_useEnvMap1f;
|
||||
material.a *= 0.502;
|
||||
|
||||
gbufferColor4f.rgb = color.rgb;
|
||||
gbufferColor4f.a = lightmap.r;
|
||||
gbufferNormal4f.rgb = normal * 0.5 + 0.5;
|
||||
gbufferNormal4f.a = lightmap.g;
|
||||
gbufferMaterial4f = vec4(material.rgb, u_useEnvMap1f);
|
||||
gbufferMaterial4f = material;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ layout(location = 0) out vec4 output4f;
|
||||
|
||||
in vec2 v_position2f;
|
||||
|
||||
uniform sampler2D u_gbufferDepthTexture;
|
||||
uniform sampler2D u_gbufferNormalTexture;
|
||||
uniform sampler2D u_fogDepthTexture;
|
||||
|
||||
@ -34,6 +33,7 @@ uniform sampler2D u_lightShaftsTexture;
|
||||
|
||||
#ifdef COMPILE_FOG_ATMOSPHERE
|
||||
uniform sampler2D u_environmentMap;
|
||||
uniform sampler2D u_skyTexture;
|
||||
uniform vec3 u_sunColorAdd3f;
|
||||
#endif
|
||||
|
||||
@ -57,11 +57,6 @@ void main() {
|
||||
}
|
||||
#endif
|
||||
|
||||
float solidDepth = textureLod(u_gbufferDepthTexture, v_position2f, 0.0).r;
|
||||
if(solidDepth != fragPos4f.z) {
|
||||
discard;
|
||||
}
|
||||
|
||||
fragPos4f.xyz *= 2.0;
|
||||
fragPos4f.xyz -= 1.0;
|
||||
|
||||
@ -85,18 +80,26 @@ void main() {
|
||||
fragPos4f.xz *= 0.75;
|
||||
|
||||
vec3 envMapSample3f;
|
||||
vec3 skyboxSample3f;
|
||||
|
||||
fragPos4f.xz *= vec2(-0.5, -0.25);
|
||||
fragPos4f.xz += vec2(0.5, 0.25);
|
||||
envMapSample3f = textureLod(u_environmentMap, fragPos4f.xz, 0.0).rgb + u_sunColorAdd3f;
|
||||
|
||||
skyboxSample3f = textureLod(u_skyTexture, v_position2f, 0.0).rgb;
|
||||
|
||||
#ifdef COMPILE_FOG_LIGHT_SHAFTS
|
||||
f2 = textureLod(u_lightShaftsTexture, v_position2f, 0.0).r;
|
||||
envMapSample3f *= pow(f2, 2.25);
|
||||
f = (f * 0.85 + 0.2) * f2 + f * (1.0 - f2);
|
||||
f2 = textureLod(u_lightShaftsTexture, v_position2f, 0.0).r * 0.95 + 0.05;
|
||||
envMapSample3f *= (f2 * 0.8 + 0.2);
|
||||
skyboxSample3f *= f2 * f2 * f2;
|
||||
f = min(f + 0.15, 1.0);
|
||||
f2 = 0.5 + f * 0.5;
|
||||
#else
|
||||
f = max(f * 1.0375 - 0.0375, 0.0);
|
||||
f2 = 0.3 + f * 0.7;
|
||||
#endif
|
||||
|
||||
output4f = vec4(envMapSample3f * fogColor4f.rgb, f);
|
||||
output4f = vec4(mix(envMapSample3f, skyboxSample3f, f2) * fogColor4f.rgb, f);
|
||||
#else
|
||||
output4f = vec4(fogColor4f.rgb, f);
|
||||
#endif
|
||||
|
@ -129,8 +129,12 @@ layout(std140) uniform u_worldLightingData {
|
||||
#ifdef COMPILE_NORMAL_MATERIAL_TEXTURE
|
||||
uniform sampler2D u_samplerNormalMaterial;
|
||||
#else
|
||||
#ifdef COMPILE_SUBSURFACE_SCATTERING
|
||||
uniform vec4 u_materialConstants4f;
|
||||
#else
|
||||
uniform vec3 u_materialConstants3f;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_metalsLUT;
|
||||
|
||||
@ -158,6 +162,7 @@ uniform sampler2D u_lightShaftsTexture;
|
||||
#endif
|
||||
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/pbr_env_map.glsl"
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/branchless_comparison.glsl"
|
||||
|
||||
#ifdef DO_COMPILE_SUN_SHADOWS
|
||||
uniform sampler2DShadow u_sunShadowDepthTexture;
|
||||
@ -167,14 +172,14 @@ vec2(-0.077, 0.995), vec2(0.998, 0.015),
|
||||
vec2(-0.116, -0.987), vec2(-0.916, 0.359),
|
||||
vec2(-0.697, -0.511), vec2(0.740, -0.612),
|
||||
vec2(0.675, 0.682));
|
||||
#define SMOOTH_SHADOW_SAMPLES 1.0 / 8.0
|
||||
#define SMOOTH_SHADOW_RADIUS 0.00075
|
||||
#define SMOOTH_SHADOW_SAMPLES (1.0 / 8.0)
|
||||
#define SMOOTH_SHADOW_RADIUS 0.000488
|
||||
#define SMOOTH_SHADOW_POISSON_SAMPLE(idx, tex, lod, vec3Pos, accum, tmpVec2)\
|
||||
tmpVec2 = vec3Pos.xy + POISSON_DISK[idx] * SMOOTH_SHADOW_RADIUS;\
|
||||
tmpVec2 = clamp(tmpVec2, vec2(0.001), vec2(0.999));\
|
||||
tmpVec2.y += lod;\
|
||||
tmpVec2.y *= SUN_SHADOW_MAP_FRAC;\
|
||||
accum += textureLod(tex, vec3(tmpVec2, vec3Pos.z), 0.0) * SMOOTH_SHADOW_SAMPLES;
|
||||
accum += textureLod(tex, vec3(tmpVec2, vec3Pos.z + 0.0001), 0.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -184,7 +189,7 @@ void main() {
|
||||
vec4 diffuseColor4f;
|
||||
vec3 normalVector3f;
|
||||
vec2 lightmapCoords2f;
|
||||
vec3 materialData3f;
|
||||
vec4 materialData4f;
|
||||
float block1f;
|
||||
|
||||
// =========== RESOLVE CONSTANTS ============ //
|
||||
@ -270,13 +275,17 @@ void main() {
|
||||
#ifdef COMPILE_NORMAL_MATERIAL_TEXTURE
|
||||
vec2 uv2 = vec2(1.0, 0.5) * texCoords2f;
|
||||
uv2.y += 0.5;
|
||||
materialData3f = texture(u_samplerNormalMaterial, uv2).rgb;
|
||||
materialData4f = texture(u_samplerNormalMaterial, uv2);
|
||||
#else
|
||||
materialData3f = u_materialConstants3f;
|
||||
#ifdef COMPILE_SUBSURFACE_SCATTERING
|
||||
materialData4f = u_materialConstants4f;
|
||||
#else
|
||||
materialData4f = vec4(u_materialConstants3f, 1.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 metalN, metalK;
|
||||
PREFETCH_METALS(diffuseColor4f.rgb, materialData3f.g, metalN, metalK)
|
||||
PREFETCH_METALS(diffuseColor4f.rgb, materialData4f.g, metalN, metalK)
|
||||
|
||||
// ============ SUN LIGHTING ============== //
|
||||
|
||||
@ -292,7 +301,7 @@ void main() {
|
||||
float skyLight = max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
|
||||
float shadowSample = 1.0;
|
||||
vec4 shadowWorldPos4f = worldPosition4f;
|
||||
shadowWorldPos4f.xyz += normalVector3f * 0.05;
|
||||
shadowWorldPos4f.xyz += normalVector3f * 0.1;
|
||||
|
||||
vec4 shadowTexPos4f;
|
||||
vec2 tmpVec2;
|
||||
@ -301,7 +310,6 @@ void main() {
|
||||
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
|
||||
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z), 0.0);
|
||||
#ifdef COMPILE_SUN_SHADOW_SMOOTH
|
||||
shadowSample *= SMOOTH_SHADOW_SAMPLES;
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(0, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(1, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(2, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
@ -309,7 +317,7 @@ void main() {
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(4, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(5, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(6, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
shadowSample = max(shadowSample * 2.0 - 1.0, 0.0);
|
||||
shadowSample *= SMOOTH_SHADOW_SAMPLES;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -339,16 +347,16 @@ void main() {
|
||||
#ifdef DO_COMPILE_SUN_SHADOWS
|
||||
lightColor3f *= shadowSample * skyLight;
|
||||
#endif
|
||||
lightColor3f = eaglercraftLighting(diffuseColor4f.rgb, lightColor3f, -worldDirection4f.xyz, u_sunDirection4f.xyz, normalVector3f, materialData3f, metalN, metalK) * u_blockSkySunDynamicLightFac4f.z;
|
||||
lightColor3f = eaglercraftLighting(diffuseColor4f.rgb, lightColor3f, -worldDirection4f.xyz, u_sunDirection4f.xyz, normalVector3f, materialData4f.rgb, metalN, metalK) * u_blockSkySunDynamicLightFac4f.z;
|
||||
}
|
||||
|
||||
float f;
|
||||
#ifdef COMPILE_PARABOLOID_ENV_MAP
|
||||
#if defined(COMPILE_PARABOLOID_ENV_MAP) && !defined(COMPILE_ENABLE_TEX_GEN)
|
||||
|
||||
// =========== ENVIRONMENT MAP =========== //
|
||||
|
||||
f = materialData3f.g < 0.06 ? 1.0 : 0.0;
|
||||
f += materialData3f.r < 0.5 ? 1.0 : 0.0;
|
||||
f = COMPARE_LT_0_ANY(materialData4f.g, 0.06);
|
||||
f += COMPARE_LT_0_ANY(materialData4f.r, 0.5);
|
||||
while(f == 0.0) {
|
||||
float dst2 = dot(worldPosition4f.xyz, worldPosition4f.xyz);
|
||||
if(dst2 > 25.0) {
|
||||
@ -365,13 +373,13 @@ void main() {
|
||||
vec4 sample2 = textureLod(u_environmentMap, reflectDir.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
|
||||
envMapSample4f = vec4(mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, reflectDir.y * -12.5 + 0.5)).rgb, min(sample1.a, sample2.a));
|
||||
}else {
|
||||
reflectDir.xz = reflectDir.xz * vec2(0.5, reflectDir.y > 0.0 ? 0.25 : -0.25);
|
||||
reflectDir.xz += vec2(0.5, reflectDir.y > 0.0 ? 0.25 : 0.75);
|
||||
reflectDir.xz = reflectDir.xz * vec2(0.5, COMPARE_GT_C_C(reflectDir.y, 0.0, 0.25, -0.25));
|
||||
reflectDir.xz += vec2(0.5, COMPARE_GT_C_C(reflectDir.y, 0.0, 0.25, 0.75));
|
||||
envMapSample4f = textureLod(u_environmentMap, reflectDir.xz, 0.0);
|
||||
}
|
||||
envMapSample4f.a += min(lightmapCoords2f.g * 2.0, 1.0) * (1.0 - envMapSample4f.a);
|
||||
if(envMapSample4f.a == 1.0) {
|
||||
lightColor3f += eaglercraftIBL_Specular(diffuseColor4f.rgb, envMapSample4f.rgb * envMapSample4f.a, worldDirection4f.xyz, normalVector3f, materialData3f, metalN, metalK) * (1.0 - sqrt(dst2) * 0.2);
|
||||
lightColor3f += eaglercraftIBL_Specular(diffuseColor4f.rgb, envMapSample4f.rgb * envMapSample4f.a, worldDirection4f.xyz, normalVector3f, materialData4f.rgb, metalN, metalK) * (1.0 - sqrt(dst2) * 0.2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -393,8 +401,8 @@ void main() {
|
||||
vec4 sample2 = textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
|
||||
skyLight += mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, irradianceMapSamplePos2f.y * -12.5 + 0.5)).rgb;
|
||||
}else {
|
||||
irradianceMapSamplePos2f.xz *= vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : -0.25);
|
||||
irradianceMapSamplePos2f.xz += vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : 0.75);
|
||||
irradianceMapSamplePos2f.xz *= vec2(0.5, COMPARE_GT_C_C(irradianceMapSamplePos2f.y, 0.0, 0.25, -0.25));
|
||||
irradianceMapSamplePos2f.xz += vec2(0.5, COMPARE_GT_C_C(irradianceMapSamplePos2f.y, 0.0, 0.25, 0.75));
|
||||
skyLight += textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz, 0.0).rgb;
|
||||
}
|
||||
skyLight *= lightmapCoords2f.g * u_sunColor3f_sky1f.w;
|
||||
@ -409,7 +417,7 @@ void main() {
|
||||
for(int i = 0; i < safeLightCount; ++i) {
|
||||
dlightDist3f = worldPosition4f.xyz - u_dynamicLightArray[i].u_lightPosition4f.xyz;
|
||||
dlightDir3f = normalize(dlightDist3f);
|
||||
dlightDir3f = materialData3f.b == 1.0 ? normalVector3f : -dlightDir3f;
|
||||
dlightDir3f = materialData4f.b == 1.0 ? normalVector3f : -dlightDir3f;
|
||||
if(dot(dlightDir3f, normalVector3f) <= 0.0) {
|
||||
continue;
|
||||
}
|
||||
@ -419,7 +427,7 @@ void main() {
|
||||
continue;
|
||||
}
|
||||
dlightColor3f *= ((cm - 0.025) / cm);
|
||||
lightColor3f += eaglercraftLighting(diffuseColor4f.rgb, dlightColor3f, -worldDirection4f.xyz, dlightDir3f, normalVector3f, materialData3f, metalN, metalK) * u_blockSkySunDynamicLightFac4f.w;
|
||||
lightColor3f += eaglercraftLighting(diffuseColor4f.rgb, dlightColor3f, -worldDirection4f.xyz, dlightDir3f, normalVector3f, materialData4f.rgb, metalN, metalK) * u_blockSkySunDynamicLightFac4f.w;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -429,7 +437,7 @@ void main() {
|
||||
vec4 fogBlend4f = vec4(0.0);
|
||||
#ifndef COMPILE_ENABLE_TEX_GEN
|
||||
while(u_fogParameters4f.x > 0.0) {
|
||||
float atmos = u_fogParameters4f.x >= 4.0 ? 4.0 : 0.0;
|
||||
float atmos = COMPARE_LT_C_C(u_fogParameters4f.x, 4.0, 0.0, 4.0);
|
||||
float type = u_fogParameters4f.x - atmos;
|
||||
fogBlend4f = mix(u_fogColorLight4f, u_fogColorDark4f, lightmapCoords2f.g);
|
||||
|
||||
@ -454,8 +462,10 @@ void main() {
|
||||
fogBlend4f.rgb *= textureLod(u_irradianceMap, atmosSamplePos.xz, 0.0).rgb;
|
||||
|
||||
#ifdef COMPILE_FOG_LIGHT_SHAFTS
|
||||
fogBlend4f.rgb *= pow(textureLod(u_lightShaftsTexture, (v_positionClip3f.xy / v_positionClip3f.z) * 0.5 + 0.5, 0.0).r * 0.9 + 0.1, 2.25);
|
||||
fogBlend4f.a = fogBlend4f.a * 0.85 + 0.2;
|
||||
fogBlend4f.rgb *= textureLod(u_lightShaftsTexture, (v_positionClip3f.xy / v_positionClip3f.z) * 0.5 + 0.5, 0.0).r * 0.76 + 0.24;
|
||||
fogBlend4f.a = min(fogBlend4f.a * 0.8 + 0.35, 1.0);
|
||||
#else
|
||||
fogBlend4f.a = max(fogBlend4f.a * 0.83 + 0.17, 0.0);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -465,7 +475,7 @@ void main() {
|
||||
|
||||
vec3 blockLight = lightmapCoords2f.r * vec3(1.0, 0.5809, 0.2433) * 2.0 * u_blockSkySunDynamicLightFac4f.x;
|
||||
skyLight *= u_blockSkySunDynamicLightFac4f.y;
|
||||
float emissive = materialData3f.b == 1.0 ? 0.0 : materialData3f.b;
|
||||
float emissive = materialData4f.b == 1.0 ? 0.0 : materialData4f.b;
|
||||
diffuseColor4f.rgb *= max(skyLight + blockLight, vec3(emissive * emissive * 20.0 + 0.075)) * 0.075;
|
||||
diffuseColor4f.rgb += lightColor3f;
|
||||
|
||||
|
@ -85,6 +85,8 @@ layout(std140) uniform u_worldLightingData {
|
||||
uniform sampler2D u_environmentMap;
|
||||
uniform sampler2D u_brdfLUT;
|
||||
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/branchless_comparison.glsl"
|
||||
|
||||
#define GLASS_ROUGHNESS 0.15
|
||||
#define GLASS_F0 0.4
|
||||
|
||||
@ -126,14 +128,14 @@ vec2(-0.077, 0.995), vec2(0.998, 0.015),
|
||||
vec2(-0.116, -0.987), vec2(-0.916, 0.359),
|
||||
vec2(-0.697, -0.511), vec2(0.740, -0.612),
|
||||
vec2(0.675, 0.682));
|
||||
#define SMOOTH_SHADOW_SAMPLES 1.0 / 8.0
|
||||
#define SMOOTH_SHADOW_RADIUS 0.00075
|
||||
#define SMOOTH_SHADOW_SAMPLES (1.0 / 8.0)
|
||||
#define SMOOTH_SHADOW_RADIUS 0.000488
|
||||
#define SMOOTH_SHADOW_POISSON_SAMPLE(idx, tex, lod, vec3Pos, accum, tmpVec2)\
|
||||
tmpVec2 = vec3Pos.xy + POISSON_DISK[idx] * SMOOTH_SHADOW_RADIUS;\
|
||||
tmpVec2 = clamp(tmpVec2, vec2(0.001), vec2(0.999));\
|
||||
tmpVec2.y += lod;\
|
||||
tmpVec2.y *= SUN_SHADOW_MAP_FRAC;\
|
||||
accum += textureLod(tex, vec3(tmpVec2, vec3Pos.z), 0.0) * SMOOTH_SHADOW_SAMPLES;
|
||||
accum += textureLod(tex, vec3(tmpVec2, vec3Pos.z + 0.0001), 0.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -184,16 +186,15 @@ void main() {
|
||||
float skyLight = max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
|
||||
float shadowSample = 1.0;
|
||||
vec4 shadowWorldPos4f = worldPosition4f;
|
||||
shadowWorldPos4f.xyz += normalVector3f * 0.05;
|
||||
shadowWorldPos4f.xyz += normalVector3f * 0.1;
|
||||
|
||||
vec4 shadowTexPos4f;
|
||||
vec2 tmpVec2;
|
||||
for(;;) {
|
||||
shadowTexPos4f = u_sunShadowMatrixLOD04f * shadowWorldPos4f;
|
||||
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
|
||||
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z), 0.0);
|
||||
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z + 0.0001), 0.0);
|
||||
#ifdef COMPILE_SUN_SHADOW_SMOOTH
|
||||
shadowSample *= SMOOTH_SHADOW_SAMPLES;
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(0, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(1, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(2, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
@ -201,7 +202,7 @@ void main() {
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(4, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(5, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(6, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
shadowSample = max(shadowSample * 2.0 - 1.0, 0.0);
|
||||
shadowSample *= SMOOTH_SHADOW_SAMPLES;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -252,8 +253,8 @@ void main() {
|
||||
vec4 sample2 = textureLod(u_environmentMap, reflectDir.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
|
||||
envMapSample4f = vec4(mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, reflectDir.y * -12.5 + 0.5)).rgb, min(sample1.a, sample2.a));
|
||||
}else {
|
||||
reflectDir.xz = reflectDir.xz * vec2(0.5, reflectDir.y > 0.0 ? 0.25 : -0.25);
|
||||
reflectDir.xz += vec2(0.5, reflectDir.y > 0.0 ? 0.25 : 0.75);
|
||||
reflectDir.xz = reflectDir.xz * vec2(0.5, COMPARE_GT_C_C(reflectDir.y, 0.0, 0.25, -0.25));
|
||||
reflectDir.xz += vec2(0.5, COMPARE_GT_C_C(reflectDir.y, 0.0 , 0.25, 0.75));
|
||||
envMapSample4f = textureLod(u_environmentMap, reflectDir.xz, 0.0);
|
||||
}
|
||||
envMapSample4f.a += min(lightmapCoords2f.g * 2.0, 1.0) * (1.0 - envMapSample4f.a);
|
||||
@ -291,7 +292,7 @@ void main() {
|
||||
|
||||
float fogFade = 0.0;
|
||||
if(u_fogParameters4f.x > 0.0) {
|
||||
float atmos = u_fogParameters4f.x >= 4.0 ? 4.0 : 0.0;
|
||||
float atmos = COMPARE_LT_C_C(u_fogParameters4f.x, 4.0, 0.0, 4.0);
|
||||
float type = u_fogParameters4f.x - atmos;
|
||||
fogFade = mix(u_fogColorDark4f.a, u_fogColorLight4f.a, lightmapCoords2f.g);
|
||||
|
||||
|
@ -53,7 +53,7 @@ void main() {
|
||||
#endif
|
||||
#ifdef DEBUG_VIEW_3
|
||||
vec4 color4f = textureLod(u_texture0, v_position2f, 0.0);
|
||||
output4f = vec4(color4f.b > 0.99 ? 1.0 : 0.0, color4f.a, 0.0, 1.0);
|
||||
output4f = vec4((color4f.a - (color4f.a > 0.5 ? 0.5 : 0.0)) * 2.0, color4f.a > 0.5 ? 1.0 : 0.0, color4f.b > 0.99 ? 1.0 : 0.0, 1.0);
|
||||
#endif
|
||||
#ifdef DEBUG_VIEW_4
|
||||
output4f = vec4(vec3(clamp((textureLod(u_texture0, v_position2f, 0.0).r - u_depthSliceStartEnd2f.x) * u_depthSliceStartEnd2f.y, 0.0, 1.0)), 1.0);
|
||||
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2025 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
// Assuming modern GPUs probably implement clamp, max, and ciel without branches
|
||||
|
||||
// value1 > value2 ? 1.0 : 0.0
|
||||
#define COMPARE_GT_0_1(value1, value2) clamp(ceil(value1 - value2), 0.0, 1.0)
|
||||
|
||||
// value1 > value2 ? N : 0.0
|
||||
#define COMPARE_GT_0_ANY(value1, value2) max(ceil(value1 - value2), 0.0)
|
||||
|
||||
// value1 < value2 ? 1.0 : 0.0
|
||||
#define COMPARE_LT_0_1(value1, value2) clamp(ceil(value2 - value1), 0.0, 1.0)
|
||||
|
||||
// value1 < value2 ? N : 0.0
|
||||
#define COMPARE_LT_0_ANY(value1, value2) max(ceil(value2 - value1), 0.0)
|
||||
|
||||
// value1 > value2 ? ifGT : ifLT
|
||||
#define COMPARE_GT_C_C(value1, value2, ifGT, ifLT) (COMPARE_GT_0_1(value1, value2) * (ifGT - ifLT) + ifLT)
|
||||
|
||||
// value1 < value2 ? ifLT : ifGT
|
||||
#define COMPARE_LT_C_C(value1, value2, ifLT, ifGT) (COMPARE_LT_0_1(value1, value2) * (ifLT - ifGT) + ifGT)
|
@ -37,6 +37,9 @@ uniform mat4 u_inverseProjectionMatrix4f;
|
||||
#ifdef COMPILE_SUN_SHADOW
|
||||
uniform sampler2D u_sunShadowTexture;
|
||||
#endif
|
||||
#ifdef COMPILE_SUBSURFACE_SCATTERING
|
||||
uniform sampler2D u_subsurfaceScatteringTexture;
|
||||
#endif
|
||||
|
||||
uniform vec3 u_sunDirection3f;
|
||||
uniform vec3 u_sunColor3f;
|
||||
@ -49,30 +52,64 @@ void main() {
|
||||
vec3 normalVector3f;
|
||||
vec2 lightmapCoords2f;
|
||||
vec3 materialData3f;
|
||||
vec4 sampleVar4f;
|
||||
|
||||
#ifdef COMPILE_SUBSURFACE_SCATTERING
|
||||
float depth = textureLod(u_gbufferDepthTexture, v_position2f, 0.0).r;
|
||||
if(depth == 0.0) {
|
||||
discard;
|
||||
}
|
||||
sampleVar4f = textureLod(u_gbufferColorTexture, v_position2f, 0.0);
|
||||
diffuseColor3f.rgb = sampleVar4f.rgb;
|
||||
diffuseColor3f *= diffuseColor3f;
|
||||
lightmapCoords2f.x = sampleVar4f.a;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_SUBSURFACE_SCATTERING
|
||||
float subsurfValue = textureLod(u_subsurfaceScatteringTexture, v_position2f, 0.0).r;
|
||||
subsurfValue *= subsurfValue;
|
||||
output4f = vec4(subsurfValue * u_sunColor3f * diffuseColor3f * 0.125, 0.0);
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_SUN_SHADOW
|
||||
#ifdef COMPILE_COLORED_SHADOW
|
||||
vec4 shadow = textureLod(u_sunShadowTexture, v_position2f, 0.0);
|
||||
if(shadow.a < 0.05) {
|
||||
#ifndef COMPILE_SUBSURFACE_SCATTERING
|
||||
discard;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
vec3 shadow = vec3(textureLod(u_sunShadowTexture, v_position2f, 0.0).r);
|
||||
#ifndef COMPILE_SUBSURFACE_SCATTERING
|
||||
if(shadow.r < 0.05) {
|
||||
#ifndef COMPILE_SUBSURFACE_SCATTERING
|
||||
discard;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef COMPILE_SUBSURFACE_SCATTERING
|
||||
float depth = textureLod(u_gbufferDepthTexture, v_position2f, 0.0).r;
|
||||
#endif
|
||||
|
||||
#ifndef COMPILE_SUN_SHADOW
|
||||
if(depth == 0.0) {
|
||||
#ifndef COMPILE_SUBSURFACE_SCATTERING
|
||||
discard;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
vec4 sampleVar4f = textureLod(u_gbufferNormalTexture, v_position2f, 0.0);
|
||||
sampleVar4f = textureLod(u_gbufferNormalTexture, v_position2f, 0.0);
|
||||
|
||||
#ifndef COMPILE_SUN_SHADOW
|
||||
vec3 shadow = vec3(sampleVar4f.a, 0.0, 0.0);
|
||||
@ -85,9 +122,12 @@ void main() {
|
||||
normalVector3f.xyz = sampleVar4f.rgb * 2.0 - 1.0;
|
||||
lightmapCoords2f.y = sampleVar4f.a;
|
||||
|
||||
#ifndef COMPILE_SUBSURFACE_SCATTERING
|
||||
sampleVar4f = textureLod(u_gbufferColorTexture, v_position2f, 0.0);
|
||||
diffuseColor3f.rgb = sampleVar4f.rgb;
|
||||
diffuseColor3f *= diffuseColor3f;
|
||||
lightmapCoords2f.x = sampleVar4f.a;
|
||||
#endif
|
||||
materialData3f = textureLod(u_gbufferMaterialTexture, v_position2f, 0.0).rgb;
|
||||
|
||||
vec3 worldSpaceNormal = normalize(mat3(u_inverseViewMatrix4f) * normalVector3f);
|
||||
@ -97,6 +137,15 @@ void main() {
|
||||
worldSpacePosition = u_inverseProjectionMatrix4f * worldSpacePosition;
|
||||
worldSpacePosition = u_inverseViewMatrix4f * vec4(worldSpacePosition.xyz / worldSpacePosition.w, 0.0);
|
||||
|
||||
diffuseColor3f *= diffuseColor3f;
|
||||
output4f = vec4(eaglercraftLighting(diffuseColor3f, u_sunColor3f * shadow.rgb, normalize(-worldSpacePosition.xyz), u_sunDirection3f, worldSpaceNormal, materialData3f), 0.0);
|
||||
}
|
||||
#ifdef COMPILE_SUBSURFACE_SCATTERING
|
||||
output4f.rgb +=
|
||||
#else
|
||||
output4f = vec4(
|
||||
#endif
|
||||
eaglercraftLighting(diffuseColor3f, u_sunColor3f * shadow.rgb, normalize(-worldSpacePosition.xyz), u_sunDirection3f, worldSpaceNormal, materialData3f)
|
||||
#ifdef COMPILE_SUBSURFACE_SCATTERING
|
||||
* (1.0 - subsurfValue * 0.0625);
|
||||
#else
|
||||
, 0.0);
|
||||
#endif
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
#line 2
|
||||
|
||||
/*
|
||||
* Copyright (c) 2023 lax1dude. All Rights Reserved.
|
||||
* Copyright (c) 2023-2025 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
@ -31,21 +31,40 @@ uniform vec3 u_lightDir3f;
|
||||
uniform sampler2D u_moonTextures;
|
||||
uniform sampler2D u_cloudsTexture;
|
||||
|
||||
#define MOON_SURFACE 0.9
|
||||
#define MOON_MARGIN 0.0125
|
||||
|
||||
void main() {
|
||||
gl_FragDepth = 0.0;
|
||||
vec4 color4f = texture(u_moonTextures, v_position2f);
|
||||
if(color4f.a < 0.99) {
|
||||
discard;
|
||||
vec2 coord2f = v_position2f * 2.0 - 1.0;
|
||||
|
||||
vec2 texUV = (coord2f * (1.0 / (MOON_SURFACE + MOON_MARGIN))) * 0.5 + 0.5;
|
||||
vec4 color4f = vec4(0.0);
|
||||
if(texUV == clamp(texUV, vec2(0.0), vec2(1.0))) {
|
||||
color4f = texture(u_moonTextures, texUV);
|
||||
}
|
||||
|
||||
vec3 moonNormal3f;
|
||||
moonNormal3f.xy = color4f.rg * 2.0 - 1.0;
|
||||
moonNormal3f.z = sqrt(1.0 - dot(moonNormal3f.xy, moonNormal3f.xy));
|
||||
float NdotV = dot(moonNormal3f, u_lightDir3f);
|
||||
output4f = vec4(u_moonColor3f * (color4f.b * color4f.b * mix(max(NdotV, 0.0), max(NdotV + 0.45, 0.0) * 0.5f, max(u_lightDir3f.z * u_lightDir3f.z * -u_lightDir3f.z, 0.0))), 0.0);
|
||||
float NdotV = max(dot(moonNormal3f, u_lightDir3f), 0.0);
|
||||
vec3 viewDir = normalize(v_position3f);
|
||||
|
||||
vec2 surfaceCoord2f = coord2f * (1.0 / MOON_SURFACE);
|
||||
vec3 moonAtmosNormalInner3f = vec3(surfaceCoord2f, sqrt(1.0 - dot(surfaceCoord2f, surfaceCoord2f)));
|
||||
vec3 moonAtmosNormalOuter3f = vec3(surfaceCoord2f, sqrt(-1.0 + dot(surfaceCoord2f, surfaceCoord2f)));
|
||||
float NdotVInner = max(dot(moonAtmosNormalInner3f, u_lightDir3f), 0.0);
|
||||
float NdotVOuter = max(dot(moonAtmosNormalOuter3f, u_lightDir3f) + 0.65, 0.0);
|
||||
|
||||
float atmosInner = max((MOON_SURFACE * 0.2) / moonAtmosNormalInner3f.z - 0.2, 0.0);
|
||||
float atmosOuter = max((MOON_SURFACE * 0.2) / moonAtmosNormalOuter3f.z - 0.4, 0.0);
|
||||
|
||||
output4f = vec4(u_moonColor3f * (color4f.b * color4f.b * NdotV + (NdotVInner * atmosInner + NdotVOuter * atmosOuter * vec3(0.8, 0.825, 0.9)) * (0.5 - max(u_lightDir3f.z, 0.0) * 0.25)), 0.0);
|
||||
|
||||
if(viewDir.y < 0.01) {
|
||||
return;
|
||||
}
|
||||
|
||||
vec2 cloudSampleCoord2f = (viewDir.xz / (viewDir.y + 1.0)) * 0.975 * 0.5 + 0.5;
|
||||
vec4 cloudSample = textureLod(u_cloudsTexture, cloudSampleCoord2f, 0.0);
|
||||
output4f.rgb = mix(output4f.rgb, output4f.rgb * max(cloudSample.a * 1.25 - 0.25, 0.0), smoothstep(0.0, 1.0, min(viewDir.y * 8.0, 1.0)));
|
||||
|
@ -19,7 +19,6 @@
|
||||
precision highp sampler2DShadow;
|
||||
|
||||
in vec4 v_position4f;
|
||||
in vec3 v_positionClip3f;
|
||||
|
||||
#ifdef COMPILE_TEXTURE_ATTRIB
|
||||
in vec2 v_texture2f;
|
||||
@ -102,14 +101,14 @@ vec2(-0.077, 0.995), vec2(0.998, 0.015),
|
||||
vec2(-0.116, -0.987), vec2(-0.916, 0.359),
|
||||
vec2(-0.697, -0.511), vec2(0.740, -0.612),
|
||||
vec2(0.675, 0.682));
|
||||
#define SMOOTH_SHADOW_SAMPLES 1.0 / 8.0
|
||||
#define SMOOTH_SHADOW_RADIUS 0.00075
|
||||
#define SMOOTH_SHADOW_SAMPLES (1.0 / 8.0)
|
||||
#define SMOOTH_SHADOW_RADIUS 0.000488
|
||||
#define SMOOTH_SHADOW_POISSON_SAMPLE(idx, tex, lod, vec3Pos, accum, tmpVec2)\
|
||||
tmpVec2 = vec3Pos.xy + POISSON_DISK[idx] * SMOOTH_SHADOW_RADIUS;\
|
||||
tmpVec2 = clamp(tmpVec2, vec2(0.001), vec2(0.999));\
|
||||
tmpVec2.y += lod;\
|
||||
tmpVec2.y *= SUN_SHADOW_MAP_FRAC;\
|
||||
accum += textureLod(tex, vec3(tmpVec2, vec3Pos.z), 0.0) * SMOOTH_SHADOW_SAMPLES;
|
||||
accum += textureLod(tex, vec3(tmpVec2, vec3Pos.z + 0.0001), 0.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -120,13 +119,11 @@ uniform sampler2D u_refractionMap;
|
||||
uniform sampler2D u_brdfLUT;
|
||||
uniform sampler2D u_normalMap;
|
||||
|
||||
#ifdef COMPILE_FOG_LIGHT_SHAFTS
|
||||
uniform sampler2D u_lightShaftsTexture;
|
||||
#endif
|
||||
|
||||
uniform vec4 u_waterWindOffset4f;
|
||||
uniform vec3 u_wavingBlockOffset3f;
|
||||
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/branchless_comparison.glsl"
|
||||
|
||||
#define WATER_ROUGHNESS 0.05
|
||||
#define WATER_F0 0.5
|
||||
|
||||
@ -301,16 +298,15 @@ void main() {
|
||||
float skyLight = max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
|
||||
float shadowSample = 1.0;
|
||||
vec4 shadowWorldPos4f = worldPosition4f;
|
||||
shadowWorldPos4f.xyz += normalVector3f * 0.05;
|
||||
shadowWorldPos4f.xyz += normalVector3f * 0.1;
|
||||
|
||||
vec4 shadowTexPos4f;
|
||||
vec2 tmpVec2;
|
||||
for(;;) {
|
||||
shadowTexPos4f = u_sunShadowMatrixLOD04f * shadowWorldPos4f;
|
||||
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
|
||||
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z), 0.0);
|
||||
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z + 0.0001), 0.0);
|
||||
#ifdef COMPILE_SUN_SHADOW_SMOOTH
|
||||
shadowSample *= SMOOTH_SHADOW_SAMPLES;
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(0, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(1, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(2, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
@ -318,7 +314,7 @@ void main() {
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(4, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(5, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(6, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
|
||||
shadowSample = max(shadowSample * 2.0 - 1.0, 0.0);
|
||||
shadowSample *= SMOOTH_SHADOW_SAMPLES;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -356,8 +352,8 @@ void main() {
|
||||
lightmapCoords2f *= lightmapCoords2f;
|
||||
|
||||
float e = 0.0;
|
||||
e += envMapSample4f.g <= 0.0 ? 0.0 : 1.0;
|
||||
e += lightmapCoords2f.y > 0.5 ? 0.0 : 1.0;
|
||||
e += COMPARE_GT_0_ANY(envMapSample4f.g, 0.0);
|
||||
e += COMPARE_LT_0_ANY(lightmapCoords2f.y, 0.5);
|
||||
//e += abs(normalVector3f.y) > 0.1 ? 0.0 : 1.0;
|
||||
if(e == 0.0) {
|
||||
vec3 reflectDir = reflect(worldDirection4f.xyz, normalVector3f);
|
||||
@ -370,8 +366,8 @@ void main() {
|
||||
vec4 sample2 = textureLod(u_environmentMap, reflectDir.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
|
||||
envMapSample4f = vec4(mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, reflectDir.y * -12.5 + 0.5)).rgb, min(sample1.a, sample2.a));
|
||||
}else {
|
||||
reflectDir.xz *= vec2(0.5, reflectDir.y > 0.0 ? 0.25 : -0.25);
|
||||
reflectDir.xz += vec2(0.5, reflectDir.y > 0.0 ? 0.25 : 0.75);
|
||||
reflectDir.xz *= vec2(0.5, COMPARE_GT_C_C(reflectDir.y, 0.0, 0.25, -0.25));
|
||||
reflectDir.xz += vec2(0.5, COMPARE_GT_C_C(reflectDir.y, 0.0, 0.25, 0.75));
|
||||
envMapSample4f = textureLod(u_environmentMap, reflectDir.xz, 0.0);
|
||||
}
|
||||
envMapSample4f.rgb *= (lightmapCoords2f.y * 2.0 - 1.0);
|
||||
@ -405,47 +401,11 @@ void main() {
|
||||
|
||||
#endif
|
||||
|
||||
// ============ CACLULATE FOG ============= //
|
||||
|
||||
vec4 fogBlend4f = vec4(0.0);
|
||||
while(u_fogParameters4f.x > 0.0) {
|
||||
float atmos = u_fogParameters4f.x >= 4.0 ? 4.0 : 0.0;
|
||||
float type = u_fogParameters4f.x - atmos;
|
||||
fogBlend4f = mix(u_fogColorLight4f, u_fogColorDark4f, lightmapCoords2f.g);
|
||||
|
||||
float f, l = length(v_position4f.xyz);
|
||||
if(type == 1.0) {
|
||||
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
|
||||
}else {
|
||||
f = 1.0 - exp(-u_fogParameters4f.y * l);
|
||||
}
|
||||
|
||||
fogBlend4f.a *= clamp(f, 0.0, 1.0);
|
||||
|
||||
if(atmos == 0.0) {
|
||||
break;
|
||||
}
|
||||
|
||||
vec3 atmosSamplePos = v_position4f.xyz / -l;
|
||||
atmosSamplePos.xz /= abs(atmosSamplePos.y) + 1.0;
|
||||
atmosSamplePos.xz *= vec2(-0.5, -0.25) * 0.75;
|
||||
atmosSamplePos.xz += vec2(0.5, 0.25);
|
||||
|
||||
fogBlend4f.rgb *= textureLod(u_irradianceMap, atmosSamplePos.xz, 0.0).rgb + u_fogColorAddSun4f.rgb;
|
||||
|
||||
#ifdef COMPILE_FOG_LIGHT_SHAFTS
|
||||
fogBlend4f.rgb *= pow(textureLod(u_lightShaftsTexture, (v_positionClip3f.xy / v_positionClip3f.z) * 0.5 + 0.5, 0.0).r * 0.9 + 0.1, 2.25);
|
||||
fogBlend4f.a = fogBlend4f.a * 0.85 + 0.2;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
// ============ OUTPUT COLOR ============== //
|
||||
|
||||
vec3 blockLight = lightmapCoords2f.r * vec3(1.0, 0.5809, 0.2433) * 2.0 * u_blockSkySunDynamicLightFac4f.x;
|
||||
vec3 skyLight = (lightmapCoords2f.g + 0.05) * vec3(0.9102, 0.9, 1.0) * u_blockSkySunDynamicLightFac4f.y;
|
||||
diffuseColor4f.rgb *= (skyLight + blockLight) * 0.075;
|
||||
diffuseColor4f.rgb += lightColor3f;
|
||||
diffuseColor4f.rgb = mix(diffuseColor4f.rgb + refractionSample.rgb, fogBlend4f.rgb, fogBlend4f.a);
|
||||
diffuseColor4f.rgb += lightColor3f + refractionSample.rgb;
|
||||
output4f = vec4(diffuseColor4f.rgb, 1.0);
|
||||
}
|
||||
|
@ -20,10 +20,6 @@ in vec3 a_position3f;
|
||||
|
||||
out vec4 v_position4f;
|
||||
|
||||
#ifdef COMPILE_FOG_LIGHT_SHAFTS
|
||||
out vec3 v_positionClip3f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_TEXTURE_ATTRIB
|
||||
in vec2 a_texture2f;
|
||||
out vec2 v_texture2f;
|
||||
@ -75,8 +71,4 @@ void main() {
|
||||
#endif
|
||||
|
||||
gl_Position = u_projectionMat4f * v_position4f;
|
||||
|
||||
#ifdef COMPILE_FOG_LIGHT_SHAFTS
|
||||
v_positionClip3f = gl_Position.xyw;
|
||||
#endif
|
||||
}
|
||||
|
@ -84,6 +84,8 @@ uniform vec4 u_nearFarPlane4f;
|
||||
|
||||
uniform vec4 u_pixelAlignment4f;
|
||||
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/branchless_comparison.glsl"
|
||||
|
||||
#define reprojDepthLimit 0.25
|
||||
|
||||
#define GET_LINEAR_DEPTH_FROM_VALUE(depthSample) (u_nearFarPlane4f.z / (u_nearFarPlane4f.y + u_nearFarPlane4f.x + (depthSample * 2.0 - 1.0) * u_nearFarPlane4f.w))
|
||||
@ -135,9 +137,9 @@ void main() {
|
||||
|
||||
#ifdef COMPILE_REPROJECT_SSR
|
||||
vec4 materials = textureLod(u_gbufferMaterialTexture, v_position2f2, 0.0);
|
||||
float f = materials.g < 0.06 ? 1.0 : 0.0;
|
||||
f += materials.r < 0.5 ? 1.0 : 0.0;
|
||||
f += materials.a > 0.5 ? 1.0 : 0.0;
|
||||
float f = COMPARE_LT_0_ANY(materials.g, 0.06);
|
||||
f += COMPARE_LT_0_ANY(materials.r, 0.5);
|
||||
f += COMPARE_GT_0_ANY(materials.a, 0.5);
|
||||
if(f > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "§eHigh Performance PBR",
|
||||
"desc": "Pack made from scratch specifically for this client, designed to give what I call the best balance between quality and performance possible in a browser but obviously that's just my opinion",
|
||||
"vers": "1.3.1",
|
||||
"vers": "1.4.0",
|
||||
"author": "lax1dude",
|
||||
"api_vers": 1,
|
||||
"features": [
|
||||
@ -19,6 +19,7 @@
|
||||
"POST_LENS_DISTORION",
|
||||
"POST_LENS_FLARES",
|
||||
"POST_BLOOM",
|
||||
"POST_FXAA"
|
||||
"POST_FXAA",
|
||||
"SUBSURFACE_SCATTERING"
|
||||
]
|
||||
}
|
@ -60,14 +60,14 @@ vec2(-0.077, 0.995), vec2(0.998, 0.015),
|
||||
vec2(-0.116, -0.987), vec2(-0.916, 0.359),
|
||||
vec2(-0.697, -0.511), vec2(0.740, -0.612),
|
||||
vec2(0.675, 0.682));
|
||||
#define SMOOTH_SHADOW_SAMPLES 1.0 / 8.0
|
||||
#define SMOOTH_SHADOW_RADIUS 0.00075
|
||||
#define SMOOTH_SHADOW_SAMPLES (1.0 / 8.0)
|
||||
#define SMOOTH_SHADOW_RADIUS 0.000488
|
||||
#define SMOOTH_SHADOW_POISSON_SAMPLE(idx, tex, lod, vec3Pos, accum, tmpVec2)\
|
||||
tmpVec2 = vec3Pos.xy + POISSON_DISK[idx] * SMOOTH_SHADOW_RADIUS;\
|
||||
tmpVec2 = clamp(tmpVec2, vec2(0.001), vec2(0.999));\
|
||||
tmpVec2.y += lod;\
|
||||
tmpVec2.y *= SUN_SHADOW_MAP_FRAC;\
|
||||
accum += textureLod(tex, vec3(tmpVec2, vec3Pos.z), 0.0) * SMOOTH_SHADOW_SAMPLES;
|
||||
accum += textureLod(tex, vec3(tmpVec2, vec3Pos.z + 0.0001), 0.0);
|
||||
#endif
|
||||
|
||||
uniform vec3 u_sunDirection3f;
|
||||
@ -97,7 +97,7 @@ void main() {
|
||||
worldSpacePosition.xyz -= 1.0;
|
||||
worldSpacePosition = u_inverseViewProjMatrix4f * worldSpacePosition;
|
||||
worldSpacePosition.xyz /= worldSpacePosition.w;
|
||||
worldSpacePosition.xyz += worldSpaceNormal * 0.05;
|
||||
worldSpacePosition.xyz += worldSpaceNormal * 0.1;
|
||||
worldSpacePosition.w = 1.0;
|
||||
float skyLight = max(normalVector4f.a * 2.0 - 1.0, 0.0);
|
||||
float shadowSample;
|
||||
@ -106,9 +106,8 @@ void main() {
|
||||
for(;;) {
|
||||
shadowSpacePosition = u_sunShadowMatrixLOD04f * worldSpacePosition;
|
||||
if(shadowSpacePosition.xyz == clamp(shadowSpacePosition.xyz, vec3(0.005), vec3(0.995))) {
|
||||
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowSpacePosition.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowSpacePosition.z), 0.0);
|
||||
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowSpacePosition.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowSpacePosition.z + 0.0001), 0.0);
|
||||
#ifdef COMPILE_SUN_SHADOW_SMOOTH
|
||||
shadowSample *= SMOOTH_SHADOW_SAMPLES;
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(0, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(1, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(2, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
@ -116,7 +115,7 @@ void main() {
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(4, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(5, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
SMOOTH_SHADOW_POISSON_SAMPLE(6, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
shadowSample = max(shadowSample * 2.0 - 1.0, 0.0);
|
||||
shadowSample *= SMOOTH_SHADOW_SAMPLES;
|
||||
#endif
|
||||
#ifdef COMPILE_COLORED_SHADOW
|
||||
shadowSpacePosition.y *= SUN_SHADOW_MAP_FRAC;
|
||||
|
@ -23,6 +23,10 @@ precision highp sampler2D;
|
||||
in vec3 v_position3f;
|
||||
in vec3 v_color3f;
|
||||
|
||||
#ifndef COMPILE_PARABOLOID_SKY
|
||||
in vec3 v_positionClip3f;
|
||||
#endif
|
||||
|
||||
layout(location = 0) out vec4 output4f;
|
||||
|
||||
uniform vec3 u_sunDirection3f;
|
||||
@ -33,10 +37,15 @@ uniform vec4 u_lightningColor4f;
|
||||
uniform sampler2D u_cloudsTexture;
|
||||
#endif
|
||||
|
||||
#ifndef COMPILE_PARABOLOID_SKY
|
||||
uniform sampler2D u_sunOcclusion;
|
||||
uniform sampler2D u_gbufferDepthTexture;
|
||||
#endif
|
||||
|
||||
#define SKY_BRIGHTNESS 5.0
|
||||
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/branchless_comparison.glsl"
|
||||
|
||||
void main() {
|
||||
gl_FragDepth = 0.0;
|
||||
vec3 viewDir = normalize(v_position3f);
|
||||
@ -46,6 +55,7 @@ void main() {
|
||||
float f = max(dot(viewDir, u_sunDirection3f) - 0.995, 0.0) * 100.0;
|
||||
float intensity = min(f * 2.0, 1.0);
|
||||
intensity *= intensity * intensity * intensity * textureLod(u_sunOcclusion, vec2(0.5, 0.5), 0.0).r * 2.0;
|
||||
intensity *= 1.0 - COMPARE_GT_0_1(textureLod(u_gbufferDepthTexture, (v_positionClip3f.xy / v_positionClip3f.z) * 0.5 + 0.5, 0.0).r, 0.0);
|
||||
output4f = vec4(v_color3f * SKY_BRIGHTNESS + intensity * u_sunColor3f, 0.0);
|
||||
#endif
|
||||
#ifdef COMPILE_CLOUDS
|
||||
|
@ -26,6 +26,10 @@ layout(location = 1) in vec2 a_colorIndex2f;
|
||||
out vec3 v_position3f;
|
||||
out vec3 v_color3f;
|
||||
|
||||
#ifndef COMPILE_PARABOLOID_SKY
|
||||
out vec3 v_positionClip3f;
|
||||
#endif
|
||||
|
||||
uniform mat4 u_viewMatrix4f;
|
||||
#ifdef COMPILE_PARABOLOID_SKY
|
||||
uniform float u_farPlane1f;
|
||||
@ -47,5 +51,6 @@ void main() {
|
||||
gl_Position = vec4(pos.xyz, 1.0);
|
||||
#else
|
||||
gl_Position = u_projMatrix4f * vec4(pos.xyz, 1.0);
|
||||
v_positionClip3f = gl_Position.xyw;
|
||||
#endif
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ uniform mat4 u_inverseProjectionMatrix4f;
|
||||
|
||||
uniform mat2 u_randomizerDataMatrix2f;
|
||||
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/branchless_comparison.glsl"
|
||||
|
||||
const vec3 ssaoKernel[8] = vec3[](
|
||||
vec3(0.599,0.721,0.350),vec3(0.114,0.791,0.601),
|
||||
vec3(0.067,0.995,0.069),vec3(0.511,-0.510,0.692),
|
||||
@ -48,8 +50,8 @@ vec3(0.716,-0.439,0.543),vec3(-0.400,0.733,0.550));
|
||||
tmpVec4_2.zw = matProjInv2f * vec4(tmpVec4_2.xy, textureLod(u_gbufferDepthTexture, tmpVec4_2.xy * 0.5 + 0.5, 0.0).r * 2.0 - 1.0, 1.0);\
|
||||
tmpVec4_2.z /= tmpVec4_2.w;\
|
||||
tmpVec4_2.x = smoothstep(0.0, 1.0, radius * 0.5 / abs(pos.z - tmpVec4_2.z));\
|
||||
divisor += tmpVec4_2.x > 0.0 ? 1.0 : 0.0;\
|
||||
occlusion += (tmpVec4_2.z >= tmpVec4_1.z ? 1.0 : 0.0) * tmpVec4_2.x;
|
||||
divisor += COMPARE_GT_0_1(tmpVec4_2.x, 0.0);\
|
||||
occlusion += COMPARE_GT_0_1(tmpVec4_2.z, tmpVec4_1.z) * tmpVec4_2.x;
|
||||
|
||||
void main() {
|
||||
vec3 originalClipSpacePos = vec3(v_position2f, textureLod(u_gbufferDepthTexture, v_position2f, 0.0).r);
|
||||
|
@ -0,0 +1,158 @@
|
||||
#line 2
|
||||
|
||||
/*
|
||||
* Copyright (c) 2025 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
precision lowp int;
|
||||
precision highp float;
|
||||
precision highp sampler2D;
|
||||
|
||||
in vec2 v_position2f;
|
||||
|
||||
layout(location = 0) out float output1f;
|
||||
|
||||
uniform mat4 u_inverseViewMatrix4f;
|
||||
uniform mat4 u_inverseViewProjMatrix4f;
|
||||
|
||||
uniform sampler2D u_gbufferNormalTexture;
|
||||
uniform sampler2D u_gbufferDepthTexture;
|
||||
uniform sampler2D u_gbufferMaterialTexture;
|
||||
uniform sampler2D u_sunShadowDepthTexture;
|
||||
|
||||
#ifdef COMPILE_SUN_SHADOW_LOD0
|
||||
uniform mat4 u_sunShadowMatrixLOD04f;
|
||||
#define SUN_SHADOW_MAP_FRAC 1.0
|
||||
#endif
|
||||
#ifdef COMPILE_SUN_SHADOW_LOD1
|
||||
uniform mat4 u_sunShadowMatrixLOD04f;
|
||||
uniform mat4 u_sunShadowMatrixLOD14f;
|
||||
#define SUN_SHADOW_MAP_FRAC 0.5
|
||||
#endif
|
||||
#ifdef COMPILE_SUN_SHADOW_LOD2
|
||||
uniform mat4 u_sunShadowMatrixLOD04f;
|
||||
uniform mat4 u_sunShadowMatrixLOD14f;
|
||||
uniform mat4 u_sunShadowMatrixLOD24f;
|
||||
#define SUN_SHADOW_MAP_FRAC 0.3333333
|
||||
#endif
|
||||
|
||||
#EAGLER INCLUDE (4) "eagler:glsl/deferred/lib/branchless_comparison.glsl"
|
||||
|
||||
const vec2 POISSON_DISK[4] = vec2[](
|
||||
vec2(0.998, -0.0438),
|
||||
vec2(-0.345, -0.933),
|
||||
vec2(-0.996, 0.046),
|
||||
vec2(0.230, 0.960));
|
||||
#define SMOOTH_SHADOW_SAMPLES (1.0 / 5.0)
|
||||
#define SMOOTH_SHADOW_RADIUS 0.000488
|
||||
#define SCATTER_POISSON_SAMPLE(idx, tex, lod, vec3Pos, accum, tmpVec2)\
|
||||
tmpVec2 = vec3Pos.xy + POISSON_DISK[idx] * SMOOTH_SHADOW_RADIUS;\
|
||||
tmpVec2 = clamp(tmpVec2, vec2(0.001), vec2(0.999));\
|
||||
tmpVec2.y += lod;\
|
||||
tmpVec2.y *= SUN_SHADOW_MAP_FRAC;\
|
||||
accum += scatterSampleInterpolated(tex, vec3(tmpVec2, vec3Pos.z));
|
||||
|
||||
#define SUN_SHADOW_DEPTH_SIZE_2F vec2(SUN_SHADOW_DEPTH_SIZE_2F_X, SUN_SHADOW_DEPTH_SIZE_2F_Y)
|
||||
#define SUN_SHADOW_DEPTH_SIZE_2F_INV vec2((1.0 / SUN_SHADOW_DEPTH_SIZE_2F_X), (1.0 / SUN_SHADOW_DEPTH_SIZE_2F_Y))
|
||||
|
||||
uniform vec3 u_sunDirection3f;
|
||||
|
||||
#define SCATTER_SAMPLE(tex, vec2Pos, comp) max(textureLod(tex, (vec2Pos), 0.0).r - comp, 0.0)
|
||||
|
||||
float scatterSampleInterpolated(in sampler2D texIn, in vec3 vec3Pos) {
|
||||
vec2 icoord2f = vec3Pos.xy * SUN_SHADOW_DEPTH_SIZE_2F;
|
||||
vec2 floor2fTmp = floor(icoord2f);
|
||||
vec2 ceil2fTmp = ceil(icoord2f);
|
||||
vec2 ret1 = vec2( // top two samples
|
||||
SCATTER_SAMPLE(texIn, (floor2fTmp + 0.5) * SUN_SHADOW_DEPTH_SIZE_2F_INV, vec3Pos.z),
|
||||
SCATTER_SAMPLE(texIn, (vec2(ceil2fTmp.x, floor2fTmp.y) + 0.5) * SUN_SHADOW_DEPTH_SIZE_2F_INV, vec3Pos.z)
|
||||
);
|
||||
vec2 ret2 = vec2( // bottom two samples
|
||||
SCATTER_SAMPLE(texIn, (vec2(floor2fTmp.x, ceil2fTmp.y) + 0.5) * SUN_SHADOW_DEPTH_SIZE_2F_INV, vec3Pos.z),
|
||||
SCATTER_SAMPLE(texIn, (ceil2fTmp + 0.5) * SUN_SHADOW_DEPTH_SIZE_2F_INV, vec3Pos.z)
|
||||
);
|
||||
vec2 factors = icoord2f - floor2fTmp;
|
||||
vec2 cunt = vec2(1.0 - factors.x, factors.x);
|
||||
ret1 = ret1 * cunt * (1.0 - factors.y) + ret2 * cunt * factors.y;
|
||||
return (ret1.x + ret1.y) * 0.25;
|
||||
}
|
||||
|
||||
void main() {
|
||||
output1f = 0.0;
|
||||
float depth = textureLod(u_gbufferDepthTexture, v_position2f, 0.0).r;
|
||||
if(depth == 0.0) {
|
||||
return;
|
||||
}
|
||||
float material1f = textureLod(u_gbufferMaterialTexture, v_position2f, 0.0).a;
|
||||
material1f = 2.0 * material1f - COMPARE_GT_0_1(material1f, 0.5);
|
||||
if(material1f < 0.05) {
|
||||
return;
|
||||
}
|
||||
vec4 normalVector4f = textureLod(u_gbufferNormalTexture, v_position2f, 0.0);
|
||||
if(normalVector4f.a < 0.5) {
|
||||
return;
|
||||
}
|
||||
normalVector4f.xyz *= 2.0;
|
||||
normalVector4f.xyz -= 1.0;
|
||||
vec3 worldSpaceNormal = normalize(mat3(u_inverseViewMatrix4f) * normalVector4f.xyz);
|
||||
vec4 worldSpacePosition = vec4(v_position2f, depth, 1.0);
|
||||
worldSpacePosition.xyz *= 2.0;
|
||||
worldSpacePosition.xyz -= 1.0;
|
||||
worldSpacePosition = u_inverseViewProjMatrix4f * worldSpacePosition;
|
||||
worldSpacePosition.xyz /= worldSpacePosition.w;
|
||||
worldSpacePosition.xyz += worldSpaceNormal * 0.05;
|
||||
worldSpacePosition.w = 1.0;
|
||||
float shadowSample;
|
||||
vec2 tmpVec2;
|
||||
vec4 shadowSpacePosition;
|
||||
for(;;) {
|
||||
shadowSpacePosition = u_sunShadowMatrixLOD04f * worldSpacePosition;
|
||||
if(shadowSpacePosition.xyz == clamp(shadowSpacePosition.xyz, vec3(0.005), vec3(0.995))) {
|
||||
shadowSample = scatterSampleInterpolated(u_sunShadowDepthTexture, vec3(shadowSpacePosition.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowSpacePosition.z));
|
||||
SCATTER_POISSON_SAMPLE(0, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
SCATTER_POISSON_SAMPLE(1, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
SCATTER_POISSON_SAMPLE(2, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
SCATTER_POISSON_SAMPLE(3, u_sunShadowDepthTexture, 0.0, shadowSpacePosition.xyz, shadowSample, tmpVec2)
|
||||
shadowSample *= SMOOTH_SHADOW_SAMPLES;
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(COMPILE_SUN_SHADOW_LOD1) || defined(COMPILE_SUN_SHADOW_LOD2)
|
||||
shadowSpacePosition = u_sunShadowMatrixLOD14f * worldSpacePosition;
|
||||
if(shadowSpacePosition.xyz == clamp(shadowSpacePosition.xyz, vec3(0.005), vec3(0.995))) {
|
||||
shadowSpacePosition.y += 1.0;
|
||||
shadowSpacePosition.y *= SUN_SHADOW_MAP_FRAC;
|
||||
shadowSample = scatterSampleInterpolated(u_sunShadowDepthTexture, vec3(shadowSpacePosition.xy, shadowSpacePosition.z + 0.00015));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_SUN_SHADOW_LOD2
|
||||
shadowSpacePosition = u_sunShadowMatrixLOD24f * worldSpacePosition;
|
||||
if(shadowSpacePosition.xyz == clamp(shadowSpacePosition.xyz, vec3(0.005), vec3(0.995))) {
|
||||
shadowSpacePosition.y += 2.0;
|
||||
shadowSpacePosition.y *= SUN_SHADOW_MAP_FRAC;
|
||||
shadowSample = scatterSampleInterpolated(u_sunShadowDepthTexture, vec3(shadowSpacePosition.xy, shadowSpacePosition.z + 0.00015));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
output1f = normalVector4f.a * min(material1f, 0.5);
|
||||
return;
|
||||
}
|
||||
|
||||
material1f = (1.0 - material1f) * 512.0;
|
||||
output1f = max(1.0 - shadowSample * material1f, 0.0);
|
||||
}
|
@ -42,6 +42,7 @@ def folder = "javascript"
|
||||
def name = "classes.js"
|
||||
|
||||
teavm.js {
|
||||
compileJava.options.encoding = "UTF-8"
|
||||
obfuscated = true
|
||||
sourceMap = true
|
||||
targetFileName = "../" + name
|
||||
|
@ -38,6 +38,7 @@ def folder = "javascript"
|
||||
def name = "classes.wasm"
|
||||
|
||||
teavm.wasmGC {
|
||||
compileJava.options.encoding = "UTF-8"
|
||||
targetFileName = "../" + name
|
||||
optimization = OptimizationLevel.AGGRESSIVE
|
||||
outOfProcess = false
|
||||
@ -51,6 +52,6 @@ teavm.wasmGC {
|
||||
debugInfoLevel = WasmDebugInfoLevel.DEOBFUSCATION;
|
||||
directMallocSupport = true
|
||||
minHeapSize = 32
|
||||
maxHeapSize = 384
|
||||
maxHeapSize = 512
|
||||
disassembly = true
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
client-version-integer=49
|
||||
client-version-integer=50
|
||||
client-package-name=net.lax1dude.eaglercraft.v1_8.client
|
||||
client-origin-name=EaglercraftX
|
||||
client-origin-version=u49
|
||||
client-origin-version=u50
|
||||
client-origin-vendor=lax1dude
|
||||
client-fork-name=EaglercraftX
|
||||
client-fork-version=u49
|
||||
client-fork-version=u50
|
||||
client-fork-vendor=lax1dude
|
||||
|
@ -5,7 +5,7 @@ function w(a){return new Promise(function(c){const b=new Image;b.addEventListene
|
||||
function y(a){return a.startsWith("data:application/octet-stream;base64,")?new Promise(function(c){x(a).then(function(b){if(b)c(b);else{n("Failed to decode base64 via fetch, doing it the slow way instead...");try{r||=u();var d=r(a,37);c(d)}catch(e){q("Failed to decode base64! "+e),c(null)}}})}):x(a)}
|
||||
function z(a,c){const b=document.createElement("h2");b.style.color="#AA0000";b.style.padding="25px";b.style.fontFamily="sans-serif";b.style.marginBlock="0px";b.appendChild(document.createTextNode(c));a.appendChild(b);c=document.createElement("h4");c.style.color="#AA0000";c.style.padding="25px";c.style.fontFamily="sans-serif";c.style.marginBlock="0px";c.appendChild(document.createTextNode("Try again later"));a.style.backgroundColor="white";a.appendChild(c)}
|
||||
window.main=async function(){if("undefined"===typeof window.eaglercraftXOpts)q("window.eaglercraftXOpts is not defined!"),alert("window.eaglercraftXOpts is not defined!");else{var a=window.eaglercraftXOpts.container;if("string"!==typeof a)q("window.eaglercraftXOpts.container is not a string!"),alert("window.eaglercraftXOpts.container is not a string!");else{var c=window.eaglercraftXOpts.assetsURI;if("string"!==typeof c)if("object"===typeof c&&"object"===typeof c[0]&&"string"===typeof c[0].url)c=c[0].url;
|
||||
else{q("window.eaglercraftXOpts.assetsURI is not a string!");alert("window.eaglercraftXOpts.assetsURI is not a string!");return}var b=document.getElementById(a);if(b){for(;a=b.lastChild;)b.removeChild(a);a=document.createElement("div");a.style.width="100%";a.style.height="100%";a.style.setProperty("image-rendering","pixelated");a.style.background='center / contain no-repeat url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAAAAAB3tzPbAAAACXBIWXMAAC4jAAAuIwF4pT92AAAG+UlEQVR42u2cy23jOhRATwbTwGwFvAJoF6BFGjColcGkASNuIPA6C68DN+BADZiCVxLSQBYqIGYBAbSdEvwWkvUzZWfymwlwCQwQUZeXPOT9URPkYs/3bj8QAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAH4x9vPvzFpAhAzM98UILmqfjDf1YT0N/cBk+71v+wDSczHmDeJ6TqO+SIfyD7IvC9g33Yc7dP6CQDxB+q62Hc2xnyJD2Sf5vuzL3Hi5MM0WbCN51u/Y/30ryEGmDVHlhwsY9Y7xlq0CuzVc4lh2n7NkGsnQ1nB7IefmrY/araJcbrq6Ryk9YqW4l3J/dHww1jdej+8kte042EW0Nba1hyWdl+9irq/FNXaD6BbQoexuvf+tQC2vX1+AFvP0kxiuyidfWwEbOtQtK0n0r6xbYCKsLcM21+pLZX3u4984Kq2xlnWDimllRudAXEpkGSHfqMzsmxfWnLWNf9aQznW4wMZWOMJxvGs/Ff5X+yPcD0g3dqZesdsI2f7Z2/73W2JSok9Gqu7P1q/I2qtj0qn/ZkTaCPWO2a0VyjrxY7sNUG1LxRlaE90MpDpGVeAxpaGobN2XPWH0aQVE1stfXPAj0+XzUmcob3aTRdVZ2+tRv+gMNBDaTkZ4k6uhtYPaK7iUkUcx9lgij92gZ6aXmxoDeK8D1hPfm18oBvTfPGwXoVG+4VfXcwl8dEOtCJS7De9M0VTqTA2p081O3kJ+uk5cU/RVN8C262Ms9HMlLHSmhNFTcc9u1uQRX4jMhqyNIk1GRk69a6hb0IDZ3pITnbfNqFuJWE9gbYrfmSqen/SiKy27G0VS20VWc+UEn59/YDPkc+0EunrAXQ/JXucYL+3VutyAqvP5wFvtEoyQPsMJMpKc3v7/Su9ALLkhAJDPCObGTDmonfNHAij3sg5866fmTHGnFt/crroh6vEv/Rq6vhEoP7hWWb2ylSQZP5zOVrDqVxSZnm/xL6OFnZwF3/4JoyGjyXu1X3n0rEFyE5Jzc5KEDfT7s2ZYs52s5e1HU88hB17nKTqAroXWPpXiHbN7R3Q8fVDbjzU6vb8hUbX67FWN8Xo4U5SIWjbukr1knY9XrcwS30aOuTatqa0vkA6cI05dyPrzWBbj7ZZrPUT2O7pdpKFtp4rph0E0AxtfN0u9kNVg25d4BPiDF0+R83dPol7/l4m4yQmQzdX+ISewqTnc8ngp94yaCan4vT+Hc228q8/T35+e8+XueSqCaPmEz9ofdbX6eSqE5iN/m4A8Qd9w/1bAEl2fPmafT3Axdv/ytlFeXUwTZyyf+NA3hWDGPrm+HXtHSdQ7nrz7fvv+MPFe/9Q3nAS+iYA3zcKCYAACIAACIAACIAACIAACIAACIAA1C2Komh++r9cogdv90M0+GoZAVHkSiGSaFmOmJdTRdESiKJ5Je4eovnSldoGNJ44gTBNbx+XH7tDYxwOniAPgEdygGWxTm/jBCAHV0u7xa90PV64IW0uOWdCapK7t600vfF2j4Ad5FCE4IopCSWMSg0Q4NgRVNKrwIBJ1ZDGxXO/5+fxhDvFQ87EsHxZMy9Sli/raMbjf9eqMpiciQG3yYOJwW1eQoBoesNBzG3yKdvqNwie1HMwiXFcwo7L7aMBtlSrC7c79RzyUm5w0f66Gk1vcJs8vFYHxUvy/u8leJz4N8t8vX5ccl04Chz5BOLR+mVVWXX5lsU4ncSOFevL7WFsJbYiPfQpcvJwhNsBxKiwcHDPNnoojzp8Jh8PnusiSMcLd1B8R5i+Igq5/BZKU3IEO8cIpoqw6L5NR8kjuOIaFR6GlmKdvmnhuFTsfqNwTBnzBOo+ZFua+jh3jAZtnksMu/b850wIfh1sVwVPhMEzKK9lz/+7Hi3Kx8CjOajVbVCEz3kIT1wyYnsD6s5t8tUaGLFpTfC7q2TH4rjzHMCoGgqTOJiMFi/TY5kduOJWHfzdtzdFrS4PYBwzhi0LAKcAdTcvKhur+VWQ3/TWcq/+LJG5VahUsILHUDGiGCmKy26cOrxlxwZUsMHlvVDW7lMQwghGOGZpmt6zcdFD47EhtQVyWySQRHUgVDzhmkeClyZFlGmiA5BH0WpyB+twPp/cgQpQBH0Lqt6qaTwfs+OW6Kl/RrdET/WqQi5BgWLDqNxmdV/Mo1X1QX5Ms0Pq/jmaP7d2/b6IVq3HW+a9qT7v6/TDNv2+tVA0hzz8klroc07AbXKmN98YQMppARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARCAD2//A2iD9ZsgY5XpAAAAAElFTkSuQmCC") white';
|
||||
else{q("window.eaglercraftXOpts.assetsURI is not a string!");alert("window.eaglercraftXOpts.assetsURI is not a string!");return}c.startsWith("data:")&&delete window.eaglercraftXOpts.assetsURI;var b=document.getElementById(a);if(b){for(;a=b.lastChild;)b.removeChild(a);a=document.createElement("div");a.style.width="100%";a.style.height="100%";a.style.setProperty("image-rendering","pixelated");a.style.background='center / contain no-repeat url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAAAAAB3tzPbAAAACXBIWXMAAC4jAAAuIwF4pT92AAAG+UlEQVR42u2cy23jOhRATwbTwGwFvAJoF6BFGjColcGkASNuIPA6C68DN+BADZiCVxLSQBYqIGYBAbSdEvwWkvUzZWfymwlwCQwQUZeXPOT9URPkYs/3bj8QAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAEQAAH4x9vPvzFpAhAzM98UILmqfjDf1YT0N/cBk+71v+wDSczHmDeJ6TqO+SIfyD7IvC9g33Yc7dP6CQDxB+q62Hc2xnyJD2Sf5vuzL3Hi5MM0WbCN51u/Y/30ryEGmDVHlhwsY9Y7xlq0CuzVc4lh2n7NkGsnQ1nB7IefmrY/araJcbrq6Ryk9YqW4l3J/dHww1jdej+8kte042EW0Nba1hyWdl+9irq/FNXaD6BbQoexuvf+tQC2vX1+AFvP0kxiuyidfWwEbOtQtK0n0r6xbYCKsLcM21+pLZX3u4984Kq2xlnWDimllRudAXEpkGSHfqMzsmxfWnLWNf9aQznW4wMZWOMJxvGs/Ff5X+yPcD0g3dqZesdsI2f7Z2/73W2JSok9Gqu7P1q/I2qtj0qn/ZkTaCPWO2a0VyjrxY7sNUG1LxRlaE90MpDpGVeAxpaGobN2XPWH0aQVE1stfXPAj0+XzUmcob3aTRdVZ2+tRv+gMNBDaTkZ4k6uhtYPaK7iUkUcx9lgij92gZ6aXmxoDeK8D1hPfm18oBvTfPGwXoVG+4VfXcwl8dEOtCJS7De9M0VTqTA2p081O3kJ+uk5cU/RVN8C262Ms9HMlLHSmhNFTcc9u1uQRX4jMhqyNIk1GRk69a6hb0IDZ3pITnbfNqFuJWE9gbYrfmSqen/SiKy27G0VS20VWc+UEn59/YDPkc+0EunrAXQ/JXucYL+3VutyAqvP5wFvtEoyQPsMJMpKc3v7/Su9ALLkhAJDPCObGTDmonfNHAij3sg5866fmTHGnFt/crroh6vEv/Rq6vhEoP7hWWb2ylSQZP5zOVrDqVxSZnm/xL6OFnZwF3/4JoyGjyXu1X3n0rEFyE5Jzc5KEDfT7s2ZYs52s5e1HU88hB17nKTqAroXWPpXiHbN7R3Q8fVDbjzU6vb8hUbX67FWN8Xo4U5SIWjbukr1knY9XrcwS30aOuTatqa0vkA6cI05dyPrzWBbj7ZZrPUT2O7pdpKFtp4rph0E0AxtfN0u9kNVg25d4BPiDF0+R83dPol7/l4m4yQmQzdX+ISewqTnc8ngp94yaCan4vT+Hc228q8/T35+e8+XueSqCaPmEz9ofdbX6eSqE5iN/m4A8Qd9w/1bAEl2fPmafT3Axdv/ytlFeXUwTZyyf+NA3hWDGPrm+HXtHSdQ7nrz7fvv+MPFe/9Q3nAS+iYA3zcKCYAACIAACIAACIAACIAACIAACIAA1C2Komh++r9cogdv90M0+GoZAVHkSiGSaFmOmJdTRdESiKJ5Je4eovnSldoGNJ44gTBNbx+XH7tDYxwOniAPgEdygGWxTm/jBCAHV0u7xa90PV64IW0uOWdCapK7t600vfF2j4Ad5FCE4IopCSWMSg0Q4NgRVNKrwIBJ1ZDGxXO/5+fxhDvFQ87EsHxZMy9Sli/raMbjf9eqMpiciQG3yYOJwW1eQoBoesNBzG3yKdvqNwie1HMwiXFcwo7L7aMBtlSrC7c79RzyUm5w0f66Gk1vcJs8vFYHxUvy/u8leJz4N8t8vX5ccl04Chz5BOLR+mVVWXX5lsU4ncSOFevL7WFsJbYiPfQpcvJwhNsBxKiwcHDPNnoojzp8Jh8PnusiSMcLd1B8R5i+Igq5/BZKU3IEO8cIpoqw6L5NR8kjuOIaFR6GlmKdvmnhuFTsfqNwTBnzBOo+ZFua+jh3jAZtnksMu/b850wIfh1sVwVPhMEzKK9lz/+7Hi3Kx8CjOajVbVCEz3kIT1wyYnsD6s5t8tUaGLFpTfC7q2TH4rjzHMCoGgqTOJiMFi/TY5kduOJWHfzdtzdFrS4PYBwzhi0LAKcAdTcvKhur+VWQ3/TWcq/+LJG5VahUsILHUDGiGCmKy26cOrxlxwZUsMHlvVDW7lMQwghGOGZpmt6zcdFD47EhtQVyWySQRHUgVDzhmkeClyZFlGmiA5BH0WpyB+twPp/cgQpQBH0Lqt6qaTwfs+OW6Kl/RrdET/WqQi5BgWLDqNxmdV/Mo1X1QX5Ms0Pq/jmaP7d2/b6IVq3HW+a9qT7v6/TDNv2+tVA0hzz8klroc07AbXKmN98YQMppARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARCAD2//A2iD9ZsgY5XpAAAAAElFTkSuQmCC") white';
|
||||
b.appendChild(a);await v();c.startsWith("data:")?(g('Downloading EPW file "<data: '+c.length+' chars>"...'),c=await y(c)):(g('Downloading EPW file "'+c+'"...'),c=await x(c));var d=!1;c?384>c.byteLength&&(q("The EPW file is too short"),d=!0):d=!0;if(d)b.removeChild(a),z(b,"Failed to download EPW file!"),q("Failed to download EPW file!");else{var e=new DataView(c);if(608649541!==e.getUint32(0,!0)||1297301847!==e.getUint32(4,!0))q("The file is not an EPW file"),d=!0;var f=c.byteLength;e.getUint32(8,
|
||||
!0)!==f&&(q("The EPW file is the wrong length"),d=!0);if(d)b.removeChild(a),z(b,"EPW file is invalid!"),q("EPW file is invalid!");else{var l=new TextDecoder("utf-8"),h=e.getUint32(100,!0),k=e.getUint32(104,!0),m=e.getUint32(108,!0),p=e.getUint32(112,!0);if(0>h||h+k>f||0>m||m+p>f)q("The EPW file contains an invalid offset (component: splash)"),d=!0;if(d)b.removeChild(a),z(b,"EPW file is invalid!"),q("EPW file is invalid!");else{h=new Uint8Array(c,h,k);m=new Uint8Array(c,m,p);l=URL.createObjectURL(new Blob([h],
|
||||
{type:l.decode(m)}));await w(l);g("Loaded splash img: "+l);a.style.background='center / contain no-repeat url("'+l+'"), 0px 0px / 1000000% 1000000% no-repeat url("'+l+'") white';await v();p=e.getUint32(164,!0);h=e.getUint32(168,!0);m=e.getUint32(180,!0);e=e.getUint32(184,!0);if(0>p||p+h>f||0>m||m+e>f)q("The EPW file contains an invalid offset (component: loader)"),d=!0;if(d)b.removeChild(a),z(b,"EPW file is invalid!"),q("EPW file is invalid!");else{a=new Uint8Array(c,p,h);a=URL.createObjectURL(new Blob([a],
|
||||
|
@ -21,7 +21,6 @@ import java.util.List;
|
||||
|
||||
import org.teavm.jso.dom.html.HTMLElement;
|
||||
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@ -68,9 +67,8 @@ public abstract class CheckboxListController<T extends SelectionListController.L
|
||||
}
|
||||
|
||||
public List<T> getSelectedItems() {
|
||||
return Lists.newArrayList(Collections2.transform(
|
||||
Collections2.filter(selectionEnableList, (e) -> (e.userVal && !e.listItem.getAlwaysSelected())),
|
||||
(e) -> (T) ((ListItemWrapper) e.listItem).parent));
|
||||
return selectionEnableList.stream().filter((e) -> (e.userVal && !e.listItem.getAlwaysSelected()))
|
||||
.map((e) -> (T) ((ListItemWrapper) e.listItem).parent).toList();
|
||||
}
|
||||
|
||||
protected void itemSelectedLow(ListItemInstance<SelectionListController.ListItem> item) {
|
||||
|
@ -23,8 +23,6 @@ import java.util.List;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.google.common.collect.Collections2;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||
|
||||
public class ClientDataEntry {
|
||||
@ -131,12 +129,12 @@ public class ClientDataEntry {
|
||||
case EAGLER_STANDARD_OFFLINE:
|
||||
default:
|
||||
toRet.add(mainPayload);
|
||||
toRet.addAll(Collections2.transform(epkFiles, (e) -> e.dataUUID));
|
||||
epkFiles.stream().map((e) -> e.dataUUID).forEach(toRet::add);
|
||||
break;
|
||||
case EAGLER_STANDARD_1_5_OFFLINE:
|
||||
toRet.add(mainPayload);
|
||||
toRet.add(integratedServer);
|
||||
toRet.addAll(Collections2.transform(epkFiles, (e) -> e.dataUUID));
|
||||
epkFiles.stream().map((e) -> e.dataUUID).forEach(toRet::add);
|
||||
break;
|
||||
case EAGLER_SIGNED_OFFLINE:
|
||||
toRet.add(mainPayload);
|
||||
|
@ -16,13 +16,10 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.boot_menu.teavm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.teavm.jso.dom.html.HTMLElement;
|
||||
|
||||
import com.google.common.collect.Collections2;
|
||||
|
||||
public abstract class MenuPopupStateConfirmation<E> extends MenuState {
|
||||
|
||||
public static enum EnumYesNoHelper {
|
||||
@ -65,7 +62,7 @@ public abstract class MenuPopupStateConfirmation<E> extends MenuState {
|
||||
this.options = options;
|
||||
this.popupController = new ConfirmationPopupController<SelectionItem>(
|
||||
BootMenuMain.bootMenuDOM.popup_confirm_opts,
|
||||
new ArrayList<SelectionItem>(Collections2.transform(options, SelectionItem::new))) {
|
||||
options.stream().map(SelectionItem::new).toList()) {
|
||||
@Override
|
||||
protected void optionSelected(SelectionItem item) {
|
||||
MenuPopupStateConfirmation.this.selectCallback(item.enumValue);
|
||||
|
@ -16,14 +16,11 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.boot_menu.teavm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.teavm.jso.dom.html.HTMLElement;
|
||||
|
||||
import com.google.common.collect.Collections2;
|
||||
|
||||
public abstract class MenuPopupStateSelection<T> extends MenuState {
|
||||
|
||||
public static class SelectionItem<E> implements SelectionListController.ListItem {
|
||||
@ -64,8 +61,7 @@ public abstract class MenuPopupStateSelection<T> extends MenuState {
|
||||
}
|
||||
|
||||
public static <T> MenuPopupStateSelection<T> createHelper(String title, List<T> items, Consumer<T> selectCallback) {
|
||||
return new MenuPopupStateSelection<T>(title,
|
||||
new ArrayList<SelectionItem<T>>(Collections2.transform(items, SelectionItem<T>::new))) {
|
||||
return new MenuPopupStateSelection<T>(title, items.stream().map(SelectionItem<T>::new).toList()) {
|
||||
@Override
|
||||
protected void itemSelected(T item) {
|
||||
selectCallback.accept(item);
|
||||
|
@ -24,9 +24,6 @@ import java.util.function.Consumer;
|
||||
|
||||
import org.teavm.jso.dom.html.HTMLElement;
|
||||
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||
@ -395,7 +392,7 @@ public class MenuStateBoot extends MenuState {
|
||||
}else if(enumValue2 == EnumImportModeMenu.AUTO_DETECT || enumValue2 == EnumImportModeMenu.EAGLERCRAFT_EPK_FILE) {
|
||||
filteredList = bootableClients;
|
||||
}else {
|
||||
filteredList = Lists.newArrayList(Collections2.filter(bootableClients, (etr) -> {
|
||||
filteredList = bootableClients.stream().filter((etr) -> {
|
||||
switch(enumValue2) {
|
||||
case EAGLERCRAFTX_1_8_OFFLINE:
|
||||
case EAGLERCRAFT_1_5_OLD_OFFLINE:
|
||||
@ -411,7 +408,7 @@ public class MenuStateBoot extends MenuState {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}));
|
||||
}).toList();
|
||||
}
|
||||
if(filteredList.size() > 0) {
|
||||
MenuStateBoot.this.changePopupState(null);
|
||||
|
@ -16,14 +16,10 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.boot_menu.teavm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.teavm.jso.dom.html.HTMLElement;
|
||||
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public abstract class MenuStateClientMultiSelect extends MenuState {
|
||||
|
||||
protected static class BootItem implements SelectionListController.ListItem {
|
||||
@ -54,7 +50,7 @@ public abstract class MenuStateClientMultiSelect extends MenuState {
|
||||
|
||||
public MenuStateClientMultiSelect(MenuState parentState, List<BootableClientEntry> bootableClients) {
|
||||
this.parentState = parentState;
|
||||
List<BootItem> list = new ArrayList<>(Collections2.transform(bootableClients, BootItem::new));
|
||||
List<BootItem> list = bootableClients.stream().map(BootItem::new).toList();
|
||||
selectionController = new CheckboxListController<BootItem>(BootMenuMain.bootMenuDOM.content_selection, list) {
|
||||
|
||||
@Override
|
||||
@ -64,7 +60,7 @@ public abstract class MenuStateClientMultiSelect extends MenuState {
|
||||
|
||||
@Override
|
||||
protected void doneSelected(List<BootItem> selectedItems) {
|
||||
MenuStateClientMultiSelect.this.onDone(Lists.newArrayList(Collections2.transform(selectedItems, (itm) -> itm.bootableClient)));
|
||||
MenuStateClientMultiSelect.this.onDone(selectedItems.stream().map((itm) -> itm.bootableClient).toList());
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -16,13 +16,10 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.boot_menu.teavm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.teavm.jso.dom.html.HTMLElement;
|
||||
|
||||
import com.google.common.collect.Collections2;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.boot_menu.teavm.OfflineDownloadParser.ParsedOfflineAdapter;
|
||||
|
||||
public class MenuStateImportMultiSelect extends MenuState {
|
||||
@ -52,7 +49,7 @@ public class MenuStateImportMultiSelect extends MenuState {
|
||||
|
||||
public MenuStateImportMultiSelect(MenuState parentState, List<ParsedOfflineAdapter> parsedClients) {
|
||||
this.parentState = parentState;
|
||||
List<BootItem> list = new ArrayList<>(Collections2.transform(parsedClients, BootItem::new));
|
||||
List<BootItem> list = parsedClients.stream().map(BootItem::new).toList();
|
||||
selectionController = new CheckboxListController<BootItem>(BootMenuMain.bootMenuDOM.content_selection, list) {
|
||||
|
||||
@Override
|
||||
|
@ -51,13 +51,13 @@ class OpenGLObjects {
|
||||
|
||||
}
|
||||
|
||||
static class BufferArrayGL implements IBufferArrayGL {
|
||||
static class VertexArrayGL implements IVertexArrayGL {
|
||||
|
||||
private static int hashGen = 0;
|
||||
final WebGLVertexArray ptr;
|
||||
final int hash;
|
||||
|
||||
BufferArrayGL(WebGLVertexArray ptr) {
|
||||
VertexArrayGL(WebGLVertexArray ptr) {
|
||||
this.ptr = ptr;
|
||||
this.hash = ++hashGen;
|
||||
}
|
||||
|
@ -405,7 +405,6 @@ public class PlatformInput {
|
||||
handleWindowFocus();
|
||||
SortedTouchEvent sorted = new SortedTouchEvent(evt, touchUIDMapperCreate);
|
||||
currentTouchState = sorted;
|
||||
List<OffsetTouch> lst = sorted.getEventTouches();
|
||||
synchronized(touchEvents) {
|
||||
touchEvents.add(sorted);
|
||||
if(touchEvents.size() > 64) {
|
||||
|
@ -149,7 +149,7 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final List<String> dumpActiveExtensions() {
|
||||
public static List<String> dumpActiveExtensions() {
|
||||
List<String> exts = new ArrayList<>();
|
||||
if(hasANGLEInstancedArrays) exts.add("ANGLE_instanced_arrays");
|
||||
if(hasEXTColorBufferFloat) exts.add("EXT_color_buffer_float");
|
||||
@ -166,64 +166,64 @@ public class PlatformOpenGL {
|
||||
return exts;
|
||||
}
|
||||
|
||||
public static final void _wglEnable(int glEnum) {
|
||||
public static void _wglEnable(int glEnum) {
|
||||
ctx.enable(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglDisable(int glEnum) {
|
||||
public static void _wglDisable(int glEnum) {
|
||||
ctx.disable(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglClearColor(float r, float g, float b, float a) {
|
||||
public static void _wglClearColor(float r, float g, float b, float a) {
|
||||
ctx.clearColor(r, g, b, a);
|
||||
}
|
||||
|
||||
public static final void _wglClearDepth(float f) {
|
||||
public static void _wglClearDepth(float f) {
|
||||
ctx.clearDepth(f);
|
||||
}
|
||||
|
||||
public static final void _wglClear(int bits) {
|
||||
public static void _wglClear(int bits) {
|
||||
ctx.clear(bits);
|
||||
}
|
||||
|
||||
public static final void _wglDepthFunc(int glEnum) {
|
||||
public static void _wglDepthFunc(int glEnum) {
|
||||
ctx.depthFunc(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglDepthMask(boolean mask) {
|
||||
public static void _wglDepthMask(boolean mask) {
|
||||
ctx.depthMask(mask);
|
||||
}
|
||||
|
||||
public static final void _wglCullFace(int glEnum) {
|
||||
public static void _wglCullFace(int glEnum) {
|
||||
ctx.cullFace(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglViewport(int x, int y, int w, int h) {
|
||||
public static void _wglViewport(int x, int y, int w, int h) {
|
||||
ctx.viewport(x, y, w, h);
|
||||
}
|
||||
|
||||
public static final void _wglBlendFunc(int src, int dst) {
|
||||
public static void _wglBlendFunc(int src, int dst) {
|
||||
ctx.blendFunc(src, dst);
|
||||
}
|
||||
|
||||
public static final void _wglBlendFuncSeparate(int srcColor, int dstColor,
|
||||
public static void _wglBlendFuncSeparate(int srcColor, int dstColor,
|
||||
int srcAlpha, int dstAlpha) {
|
||||
ctx.blendFuncSeparate(srcColor, dstColor, srcAlpha, dstAlpha);
|
||||
}
|
||||
|
||||
public static final void _wglBlendEquation(int glEnum) {
|
||||
public static void _wglBlendEquation(int glEnum) {
|
||||
ctx.blendEquation(glEnum);
|
||||
}
|
||||
|
||||
public static final void _wglBlendColor(float r, float g, float b, float a) {
|
||||
public static void _wglBlendColor(float r, float g, float b, float a) {
|
||||
ctx.blendColor(r, g, b, a);
|
||||
}
|
||||
|
||||
public static final void _wglColorMask(boolean r, boolean g, boolean b, boolean a) {
|
||||
public static void _wglColorMask(boolean r, boolean g, boolean b, boolean a) {
|
||||
ctx.colorMask(r, g, b, a);
|
||||
}
|
||||
|
||||
public static final void _wglDrawBuffers(int buffer) {
|
||||
public static void _wglDrawBuffers(int buffer) {
|
||||
if(glesVers == 200) {
|
||||
if(buffer != 0x8CE0) { // GL_COLOR_ATTACHMENT0
|
||||
throw new UnsupportedOperationException();
|
||||
@ -233,7 +233,7 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglDrawBuffers(int[] buffers) {
|
||||
public static void _wglDrawBuffers(int[] buffers) {
|
||||
if(glesVers == 200) {
|
||||
if(buffers.length != 1 || buffers[0] != 0x8CE0) { // GL_COLOR_ATTACHMENT0
|
||||
throw new UnsupportedOperationException();
|
||||
@ -243,83 +243,83 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglReadBuffer(int buffer) {
|
||||
public static void _wglReadBuffer(int buffer) {
|
||||
ctx.readBuffer(buffer);
|
||||
}
|
||||
|
||||
public static final void _wglReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer data) {
|
||||
public static void _wglReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer data) {
|
||||
ctx.readPixels(x, y, width, height, format, type, EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
||||
}
|
||||
|
||||
public static final void _wglReadPixels_u16(int x, int y, int width, int height, int format, int type, ByteBuffer data) {
|
||||
public static void _wglReadPixels_u16(int x, int y, int width, int height, int format, int type, ByteBuffer data) {
|
||||
ctx.readPixels(x, y, width, height, format, type, EaglerArrayBufferAllocator.getDataView16Unsigned(data));
|
||||
}
|
||||
|
||||
public static final void _wglReadPixels(int x, int y, int width, int height, int format, int type, IntBuffer data) {
|
||||
public static void _wglReadPixels(int x, int y, int width, int height, int format, int type, IntBuffer data) {
|
||||
ctx.readPixels(x, y, width, height, format, type, EaglerArrayBufferAllocator.getDataView32(data));
|
||||
}
|
||||
|
||||
public static final void _wglReadPixels(int x, int y, int width, int height, int format, int type, FloatBuffer data) {
|
||||
public static void _wglReadPixels(int x, int y, int width, int height, int format, int type, FloatBuffer data) {
|
||||
ctx.readPixels(x, y, width, height, format, type, EaglerArrayBufferAllocator.getDataView32F(data));
|
||||
}
|
||||
|
||||
public static final void _wglPolygonOffset(float f1, float f2) {
|
||||
public static void _wglPolygonOffset(float f1, float f2) {
|
||||
ctx.polygonOffset(f1, f2);
|
||||
}
|
||||
|
||||
public static final void _wglLineWidth(float width) {
|
||||
public static void _wglLineWidth(float width) {
|
||||
ctx.lineWidth(width);
|
||||
}
|
||||
|
||||
public static final IBufferGL _wglGenBuffers() {
|
||||
public static IBufferGL _wglGenBuffers() {
|
||||
return new OpenGLObjects.BufferGL(ctx.createBuffer());
|
||||
}
|
||||
|
||||
public static final ITextureGL _wglGenTextures() {
|
||||
public static ITextureGL _wglGenTextures() {
|
||||
return new OpenGLObjects.TextureGL(ctx.createTexture());
|
||||
}
|
||||
|
||||
public static final IBufferArrayGL _wglGenVertexArrays() {
|
||||
public static IVertexArrayGL _wglGenVertexArrays() {
|
||||
switch(vertexArrayImpl) {
|
||||
case VAO_IMPL_CORE:
|
||||
return new OpenGLObjects.BufferArrayGL(ctx.createVertexArray());
|
||||
return new OpenGLObjects.VertexArrayGL(ctx.createVertexArray());
|
||||
case VAO_IMPL_OES:
|
||||
return new OpenGLObjects.BufferArrayGL(OESVertexArrayObject.createVertexArrayOES());
|
||||
return new OpenGLObjects.VertexArrayGL(OESVertexArrayObject.createVertexArrayOES());
|
||||
default:
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
public static final IProgramGL _wglCreateProgram() {
|
||||
public static IProgramGL _wglCreateProgram() {
|
||||
return new OpenGLObjects.ProgramGL(ctx.createProgram());
|
||||
}
|
||||
|
||||
public static final IShaderGL _wglCreateShader(int type) {
|
||||
public static IShaderGL _wglCreateShader(int type) {
|
||||
return new OpenGLObjects.ShaderGL(ctx.createShader(type));
|
||||
}
|
||||
|
||||
public static final IFramebufferGL _wglCreateFramebuffer() {
|
||||
public static IFramebufferGL _wglCreateFramebuffer() {
|
||||
return new OpenGLObjects.FramebufferGL(ctx.createFramebuffer());
|
||||
}
|
||||
|
||||
public static final IRenderbufferGL _wglCreateRenderbuffer() {
|
||||
public static IRenderbufferGL _wglCreateRenderbuffer() {
|
||||
return new OpenGLObjects.RenderbufferGL(ctx.createRenderbuffer());
|
||||
}
|
||||
|
||||
public static final IQueryGL _wglGenQueries() {
|
||||
public static IQueryGL _wglGenQueries() {
|
||||
return new OpenGLObjects.QueryGL(ctx.createQuery());
|
||||
}
|
||||
|
||||
public static final void _wglDeleteBuffers(IBufferGL obj) {
|
||||
public static void _wglDeleteBuffers(IBufferGL obj) {
|
||||
ctx.deleteBuffer(((OpenGLObjects.BufferGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteTextures(ITextureGL obj) {
|
||||
public static void _wglDeleteTextures(ITextureGL obj) {
|
||||
ctx.deleteTexture(((OpenGLObjects.TextureGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteVertexArrays(IBufferArrayGL obj) {
|
||||
WebGLVertexArray ptr = ((OpenGLObjects.BufferArrayGL)obj).ptr;
|
||||
public static void _wglDeleteVertexArrays(IVertexArrayGL obj) {
|
||||
WebGLVertexArray ptr = ((OpenGLObjects.VertexArrayGL)obj).ptr;
|
||||
switch(vertexArrayImpl) {
|
||||
case VAO_IMPL_CORE:
|
||||
ctx.deleteVertexArray(ptr);
|
||||
@ -332,60 +332,60 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglDeleteProgram(IProgramGL obj) {
|
||||
public static void _wglDeleteProgram(IProgramGL obj) {
|
||||
ctx.deleteProgram(((OpenGLObjects.ProgramGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteShader(IShaderGL obj) {
|
||||
public static void _wglDeleteShader(IShaderGL obj) {
|
||||
ctx.deleteShader(((OpenGLObjects.ShaderGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteFramebuffer(IFramebufferGL obj) {
|
||||
public static void _wglDeleteFramebuffer(IFramebufferGL obj) {
|
||||
ctx.deleteFramebuffer(((OpenGLObjects.FramebufferGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteRenderbuffer(IRenderbufferGL obj) {
|
||||
public static void _wglDeleteRenderbuffer(IRenderbufferGL obj) {
|
||||
ctx.deleteRenderbuffer(((OpenGLObjects.RenderbufferGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDeleteQueries(IQueryGL obj) {
|
||||
public static void _wglDeleteQueries(IQueryGL obj) {
|
||||
ctx.deleteQuery(((OpenGLObjects.QueryGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglBindBuffer(int target, IBufferGL obj) {
|
||||
public static void _wglBindBuffer(int target, IBufferGL obj) {
|
||||
ctx.bindBuffer(target, obj != null ? ((OpenGLObjects.BufferGL)obj).ptr : null);
|
||||
}
|
||||
|
||||
public static final void _wglBufferData(int target, ByteBuffer data, int usage) {
|
||||
public static void _wglBufferData(int target, ByteBuffer data, int usage) {
|
||||
ctx.bufferData(target, EaglerArrayBufferAllocator.getDataView8(data), usage);
|
||||
}
|
||||
|
||||
public static final void _wglBufferData(int target, IntBuffer data, int usage) {
|
||||
public static void _wglBufferData(int target, IntBuffer data, int usage) {
|
||||
ctx.bufferData(target, EaglerArrayBufferAllocator.getDataView32(data), usage);
|
||||
}
|
||||
|
||||
public static final void _wglBufferData(int target, FloatBuffer data, int usage) {
|
||||
public static void _wglBufferData(int target, FloatBuffer data, int usage) {
|
||||
ctx.bufferData(target, EaglerArrayBufferAllocator.getDataView32F(data), usage);
|
||||
}
|
||||
|
||||
public static final void _wglBufferData(int target, int size, int usage) {
|
||||
public static void _wglBufferData(int target, int size, int usage) {
|
||||
ctx.bufferData(target, size, usage);
|
||||
}
|
||||
|
||||
public static final void _wglBufferSubData(int target, int offset, ByteBuffer data) {
|
||||
public static void _wglBufferSubData(int target, int offset, ByteBuffer data) {
|
||||
ctx.bufferSubData(target, offset, EaglerArrayBufferAllocator.getDataView8(data));
|
||||
}
|
||||
|
||||
public static final void _wglBufferSubData(int target, int offset, IntBuffer data) {
|
||||
public static void _wglBufferSubData(int target, int offset, IntBuffer data) {
|
||||
ctx.bufferSubData(target, offset, EaglerArrayBufferAllocator.getDataView32(data));
|
||||
}
|
||||
|
||||
public static final void _wglBufferSubData(int target, int offset, FloatBuffer data) {
|
||||
public static void _wglBufferSubData(int target, int offset, FloatBuffer data) {
|
||||
ctx.bufferSubData(target, offset, EaglerArrayBufferAllocator.getDataView32F(data));
|
||||
}
|
||||
|
||||
public static final void _wglBindVertexArray(IBufferArrayGL obj) {
|
||||
WebGLVertexArray ptr = obj != null ? ((OpenGLObjects.BufferArrayGL)obj).ptr : null;
|
||||
public static void _wglBindVertexArray(IVertexArrayGL obj) {
|
||||
WebGLVertexArray ptr = obj != null ? ((OpenGLObjects.VertexArrayGL)obj).ptr : null;
|
||||
switch(vertexArrayImpl) {
|
||||
case VAO_IMPL_CORE:
|
||||
ctx.bindVertexArray(ptr);
|
||||
@ -398,20 +398,20 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglEnableVertexAttribArray(int index) {
|
||||
public static void _wglEnableVertexAttribArray(int index) {
|
||||
ctx.enableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public static final void _wglDisableVertexAttribArray(int index) {
|
||||
public static void _wglDisableVertexAttribArray(int index) {
|
||||
ctx.disableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public static final void _wglVertexAttribPointer(int index, int size, int type,
|
||||
public static void _wglVertexAttribPointer(int index, int size, int type,
|
||||
boolean normalized, int stride, int offset) {
|
||||
ctx.vertexAttribPointer(index, size, type, normalized, stride, offset);
|
||||
}
|
||||
|
||||
public static final void _wglVertexAttribDivisor(int index, int divisor) {
|
||||
public static void _wglVertexAttribDivisor(int index, int divisor) {
|
||||
switch(instancingImpl) {
|
||||
case INSTANCE_IMPL_CORE:
|
||||
ctx.vertexAttribDivisor(index, divisor);
|
||||
@ -424,153 +424,153 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void _wglActiveTexture(int texture) {
|
||||
public static void _wglActiveTexture(int texture) {
|
||||
ctx.activeTexture(texture);
|
||||
}
|
||||
|
||||
public static final void _wglBindTexture(int target, ITextureGL obj) {
|
||||
public static void _wglBindTexture(int target, ITextureGL obj) {
|
||||
ctx.bindTexture(target, obj == null ? null : ((OpenGLObjects.TextureGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglTexParameterf(int target, int param, float value) {
|
||||
public static void _wglTexParameterf(int target, int param, float value) {
|
||||
ctx.texParameterf(target, param, value);
|
||||
}
|
||||
|
||||
public static final void _wglTexParameteri(int target, int param, int value) {
|
||||
public static void _wglTexParameteri(int target, int param, int value) {
|
||||
ctx.texParameteri(target, param, value);
|
||||
}
|
||||
|
||||
public static final void _wglTexImage3D(int target, int level, int internalFormat, int width, int height, int depth,
|
||||
public static void _wglTexImage3D(int target, int level, int internalFormat, int width, int height, int depth,
|
||||
int border, int format, int type, ByteBuffer data) {
|
||||
ctx.texImage3D(target, level, internalFormat, width, height, depth, border, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2D(int target, int level, int internalFormat, int width,
|
||||
public static void _wglTexImage2D(int target, int level, int internalFormat, int width,
|
||||
int height, int border, int format, int type, ByteBuffer data) {
|
||||
ctx.texImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2Du16(int target, int level, int internalFormat, int width,
|
||||
public static void _wglTexImage2Du16(int target, int level, int internalFormat, int width,
|
||||
int height, int border, int format, int type, ByteBuffer data) {
|
||||
ctx.texImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView16Unsigned(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2Df32(int target, int level, int internalFormat, int width,
|
||||
public static void _wglTexImage2Df32(int target, int level, int internalFormat, int width,
|
||||
int height, int border, int format, int type, ByteBuffer data) {
|
||||
ctx.texImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView32F(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2D(int target, int level, int internalFormat, int width,
|
||||
public static void _wglTexImage2D(int target, int level, int internalFormat, int width,
|
||||
int height, int border, int format, int type, IntBuffer data) {
|
||||
ctx.texImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexImage2Df32(int target, int level, int internalFormat, int width,
|
||||
public static void _wglTexImage2Df32(int target, int level, int internalFormat, int width,
|
||||
int height, int border, int format, int type, FloatBuffer data) {
|
||||
ctx.texImage2D(target, level, internalFormat, width, height, border, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView32F(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
public static void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format, int type, ByteBuffer data) {
|
||||
ctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexSubImage2Du16(int target, int level, int xoffset, int yoffset,
|
||||
public static void _wglTexSubImage2Du16(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format, int type, ByteBuffer data) {
|
||||
ctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView16Unsigned(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
public static void _wglTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format, int type, IntBuffer data) {
|
||||
ctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView8Unsigned(data));
|
||||
}
|
||||
|
||||
public static final void _wglTexSubImage2Df32(int target, int level, int xoffset, int yoffset,
|
||||
public static void _wglTexSubImage2Df32(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format, int type, FloatBuffer data) {
|
||||
ctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
|
||||
data == null ? null : EaglerArrayBufferAllocator.getDataView32F(data));
|
||||
}
|
||||
|
||||
public static final void _wglCopyTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
public static void _wglCopyTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int x, int y, int width, int height) {
|
||||
ctx.copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
public static final void _wglTexStorage2D(int target, int levels, int internalFormat, int w, int h) {
|
||||
public static void _wglTexStorage2D(int target, int levels, int internalFormat, int w, int h) {
|
||||
ctx.texStorage2D(target, levels, internalFormat, w, h);
|
||||
}
|
||||
|
||||
public static final void _wglPixelStorei(int pname, int value) {
|
||||
public static void _wglPixelStorei(int pname, int value) {
|
||||
ctx.pixelStorei(pname, value);
|
||||
}
|
||||
|
||||
public static final void _wglGenerateMipmap(int target) {
|
||||
public static void _wglGenerateMipmap(int target) {
|
||||
ctx.generateMipmap(target);
|
||||
}
|
||||
|
||||
public static final void _wglShaderSource(IShaderGL obj, String source) {
|
||||
public static void _wglShaderSource(IShaderGL obj, String source) {
|
||||
ctx.shaderSource(((OpenGLObjects.ShaderGL)obj).ptr, source);
|
||||
}
|
||||
|
||||
public static final void _wglCompileShader(IShaderGL obj) {
|
||||
public static void _wglCompileShader(IShaderGL obj) {
|
||||
ctx.compileShader(((OpenGLObjects.ShaderGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final int _wglGetShaderi(IShaderGL obj, int param) {
|
||||
public static int _wglGetShaderi(IShaderGL obj, int param) {
|
||||
return ctx.getShaderParameteri(((OpenGLObjects.ShaderGL)obj).ptr, param);
|
||||
}
|
||||
|
||||
public static final String _wglGetShaderInfoLog(IShaderGL obj) {
|
||||
public static String _wglGetShaderInfoLog(IShaderGL obj) {
|
||||
return ctx.getShaderInfoLog(((OpenGLObjects.ShaderGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglUseProgram(IProgramGL obj) {
|
||||
public static void _wglUseProgram(IProgramGL obj) {
|
||||
ctx.useProgram(obj == null ? null : ((OpenGLObjects.ProgramGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglAttachShader(IProgramGL obj, IShaderGL shader) {
|
||||
public static void _wglAttachShader(IProgramGL obj, IShaderGL shader) {
|
||||
ctx.attachShader(((OpenGLObjects.ProgramGL)obj).ptr, ((OpenGLObjects.ShaderGL)shader).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglDetachShader(IProgramGL obj, IShaderGL shader) {
|
||||
public static void _wglDetachShader(IProgramGL obj, IShaderGL shader) {
|
||||
ctx.detachShader(((OpenGLObjects.ProgramGL)obj).ptr, ((OpenGLObjects.ShaderGL)shader).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglLinkProgram(IProgramGL obj) {
|
||||
public static void _wglLinkProgram(IProgramGL obj) {
|
||||
ctx.linkProgram(((OpenGLObjects.ProgramGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final int _wglGetProgrami(IProgramGL obj, int param) {
|
||||
public static int _wglGetProgrami(IProgramGL obj, int param) {
|
||||
return ctx.getProgramParameteri(((OpenGLObjects.ProgramGL)obj).ptr, param);
|
||||
}
|
||||
|
||||
public static final String _wglGetProgramInfoLog(IProgramGL obj) {
|
||||
public static String _wglGetProgramInfoLog(IProgramGL obj) {
|
||||
return ctx.getProgramInfoLog(((OpenGLObjects.ProgramGL)obj).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglBindAttribLocation(IProgramGL obj, int index, String name) {
|
||||
public static void _wglBindAttribLocation(IProgramGL obj, int index, String name) {
|
||||
ctx.bindAttribLocation(((OpenGLObjects.ProgramGL)obj).ptr, index, name);
|
||||
}
|
||||
|
||||
public static final int _wglGetAttribLocation(IProgramGL obj, String name) {
|
||||
public static int _wglGetAttribLocation(IProgramGL obj, String name) {
|
||||
return ctx.getAttribLocation(((OpenGLObjects.ProgramGL)obj).ptr, name);
|
||||
}
|
||||
|
||||
public static final void _wglDrawArrays(int mode, int first, int count) {
|
||||
public static void _wglDrawArrays(int mode, int first, int count) {
|
||||
ctx.drawArrays(mode, first, count);
|
||||
//checkErr("_wglDrawArrays(" + mode + ", " + first + ", " + count + ");");
|
||||
}
|
||||
|
||||
public static final void _wglDrawArraysInstanced(int mode, int first, int count, int instances) {
|
||||
public static void _wglDrawArraysInstanced(int mode, int first, int count, int instances) {
|
||||
switch(instancingImpl) {
|
||||
case INSTANCE_IMPL_CORE:
|
||||
ctx.drawArraysInstanced(mode, first, count, instances);
|
||||
@ -584,12 +584,12 @@ public class PlatformOpenGL {
|
||||
//checkErr("_wglDrawArraysInstanced(" + mode + ", " + first + ", " + count + ", " + instanced + ");");
|
||||
}
|
||||
|
||||
public static final void _wglDrawElements(int mode, int count, int type, int offset) {
|
||||
public static void _wglDrawElements(int mode, int count, int type, int offset) {
|
||||
ctx.drawElements(mode, count, type, offset);
|
||||
//checkErr("_wglDrawElements(" + mode + ", " + count + ", " + type + ", " + offset + ");");
|
||||
}
|
||||
|
||||
public static final void _wglDrawElementsInstanced(int mode, int count, int type, int offset, int instances) {
|
||||
public static void _wglDrawElementsInstanced(int mode, int count, int type, int offset, int instances) {
|
||||
switch(instancingImpl) {
|
||||
case INSTANCE_IMPL_CORE:
|
||||
ctx.drawElementsInstanced(mode, count, type, offset, instances);
|
||||
@ -603,7 +603,7 @@ public class PlatformOpenGL {
|
||||
//checkErr("_wglDrawElementsInstanced(" + mode + ", " + count + ", " + type + ", " + offset + ", " + instanced + ");");
|
||||
}
|
||||
|
||||
public static final IUniformGL _wglGetUniformLocation(IProgramGL obj, String name) {
|
||||
public static IUniformGL _wglGetUniformLocation(IProgramGL obj, String name) {
|
||||
WebGLUniformLocation loc = ctx.getUniformLocation(((OpenGLObjects.ProgramGL)obj).ptr, name);
|
||||
if(loc != null) {
|
||||
return new OpenGLObjects.UniformGL(loc);
|
||||
@ -612,7 +612,7 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final int _wglGetUniformBlockIndex(IProgramGL obj, String name) {
|
||||
public static int _wglGetUniformBlockIndex(IProgramGL obj, String name) {
|
||||
int i = ctx.getUniformBlockIndex(((OpenGLObjects.ProgramGL)obj).ptr, name);
|
||||
if(i > 2147483647) {
|
||||
i = -1;
|
||||
@ -620,77 +620,77 @@ public class PlatformOpenGL {
|
||||
return i;
|
||||
}
|
||||
|
||||
public static final void _wglBindBufferRange(int target, int index, IBufferGL buffer, int offset, int size) {
|
||||
public static void _wglBindBufferRange(int target, int index, IBufferGL buffer, int offset, int size) {
|
||||
ctx.bindBufferRange(target, index, ((OpenGLObjects.BufferGL)buffer).ptr, offset, size);
|
||||
}
|
||||
|
||||
public static final void _wglUniformBlockBinding(IProgramGL obj, int blockIndex, int bufferIndex) {
|
||||
public static void _wglUniformBlockBinding(IProgramGL obj, int blockIndex, int bufferIndex) {
|
||||
ctx.uniformBlockBinding(((OpenGLObjects.ProgramGL)obj).ptr, blockIndex, bufferIndex);
|
||||
}
|
||||
|
||||
public static final void _wglUniform1f(IUniformGL obj, float x) {
|
||||
public static void _wglUniform1f(IUniformGL obj, float x) {
|
||||
if(obj != null) ctx.uniform1f(((OpenGLObjects.UniformGL)obj).ptr, x);
|
||||
}
|
||||
|
||||
public static final void _wglUniform2f(IUniformGL obj, float x, float y) {
|
||||
public static void _wglUniform2f(IUniformGL obj, float x, float y) {
|
||||
if(obj != null) ctx.uniform2f(((OpenGLObjects.UniformGL)obj).ptr, x, y);
|
||||
}
|
||||
|
||||
public static final void _wglUniform3f(IUniformGL obj, float x, float y, float z) {
|
||||
public static void _wglUniform3f(IUniformGL obj, float x, float y, float z) {
|
||||
if(obj != null) ctx.uniform3f(((OpenGLObjects.UniformGL)obj).ptr, x, y, z);
|
||||
}
|
||||
|
||||
public static final void _wglUniform4f(IUniformGL obj, float x, float y, float z, float w) {
|
||||
public static void _wglUniform4f(IUniformGL obj, float x, float y, float z, float w) {
|
||||
if(obj != null) ctx.uniform4f(((OpenGLObjects.UniformGL)obj).ptr, x, y, z, w);
|
||||
}
|
||||
|
||||
public static final void _wglUniform1i(IUniformGL obj, int x) {
|
||||
public static void _wglUniform1i(IUniformGL obj, int x) {
|
||||
if(obj != null) ctx.uniform1i(((OpenGLObjects.UniformGL)obj).ptr, x);
|
||||
}
|
||||
|
||||
public static final void _wglUniform2i(IUniformGL obj, int x, int y) {
|
||||
public static void _wglUniform2i(IUniformGL obj, int x, int y) {
|
||||
if(obj != null) ctx.uniform2i(((OpenGLObjects.UniformGL)obj).ptr, x, y);
|
||||
}
|
||||
|
||||
public static final void _wglUniform3i(IUniformGL obj, int x, int y, int z) {
|
||||
public static void _wglUniform3i(IUniformGL obj, int x, int y, int z) {
|
||||
if(obj != null) ctx.uniform3i(((OpenGLObjects.UniformGL)obj).ptr, x, y, z);
|
||||
}
|
||||
|
||||
public static final void _wglUniform4i(IUniformGL obj, int x, int y, int z, int w) {
|
||||
public static void _wglUniform4i(IUniformGL obj, int x, int y, int z, int w) {
|
||||
if(obj != null) ctx.uniform4i(((OpenGLObjects.UniformGL)obj).ptr, x, y, z, w);
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if(obj != null) ctx.uniformMatrix2fv(((OpenGLObjects.UniformGL)obj).ptr, transpose,
|
||||
mat == null ? null : EaglerArrayBufferAllocator.getDataView32F(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix3fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix3fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if(obj != null) ctx.uniformMatrix3fv(((OpenGLObjects.UniformGL)obj).ptr, transpose,
|
||||
mat == null ? null : EaglerArrayBufferAllocator.getDataView32F(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix3x2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix3x2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if(obj != null) ctx.uniformMatrix3x2fv(((OpenGLObjects.UniformGL)obj).ptr, transpose,
|
||||
mat == null ? null : EaglerArrayBufferAllocator.getDataView32F(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix4fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix4fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if(obj != null) ctx.uniformMatrix4fv(((OpenGLObjects.UniformGL)obj).ptr, transpose,
|
||||
mat == null ? null : EaglerArrayBufferAllocator.getDataView32F(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix4x2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix4x2fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if(obj != null) ctx.uniformMatrix4x2fv(((OpenGLObjects.UniformGL)obj).ptr, transpose,
|
||||
mat == null ? null : EaglerArrayBufferAllocator.getDataView32F(mat));
|
||||
}
|
||||
|
||||
public static final void _wglUniformMatrix4x3fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
public static void _wglUniformMatrix4x3fv(IUniformGL obj, boolean transpose, FloatBuffer mat) {
|
||||
if(obj != null) ctx.uniformMatrix4x3fv(((OpenGLObjects.UniformGL)obj).ptr, transpose,
|
||||
mat == null ? null : EaglerArrayBufferAllocator.getDataView32F(mat));
|
||||
}
|
||||
|
||||
public static final void _wglBindFramebuffer(int target, IFramebufferGL framebuffer) {
|
||||
public static void _wglBindFramebuffer(int target, IFramebufferGL framebuffer) {
|
||||
if(framebuffer == null) {
|
||||
ctx.bindFramebuffer(target, PlatformRuntime.mainFramebuffer);
|
||||
if(glesVers != 200) {
|
||||
@ -701,41 +701,41 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final int _wglCheckFramebufferStatus(int target) {
|
||||
public static int _wglCheckFramebufferStatus(int target) {
|
||||
return ctx.checkFramebufferStatus(target);
|
||||
}
|
||||
|
||||
public static final void _wglFramebufferTexture2D(int target, int attachment, int texTarget,
|
||||
public static void _wglFramebufferTexture2D(int target, int attachment, int texTarget,
|
||||
ITextureGL texture, int level) {
|
||||
ctx.framebufferTexture2D(target, attachment, texTarget, ((OpenGLObjects.TextureGL)texture).ptr, level);
|
||||
}
|
||||
|
||||
public static final void _wglFramebufferTextureLayer(int target, int attachment, ITextureGL texture, int level, int layer) {
|
||||
public static void _wglFramebufferTextureLayer(int target, int attachment, ITextureGL texture, int level, int layer) {
|
||||
ctx.framebufferTextureLayer(target, attachment, ((OpenGLObjects.TextureGL) texture).ptr, level, layer);
|
||||
}
|
||||
|
||||
public static final void _wglBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1,
|
||||
public static void _wglBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1,
|
||||
int dstX0, int dstY0, int dstX1, int dstY1, int bits, int filter) {
|
||||
ctx.blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, bits, filter);
|
||||
}
|
||||
|
||||
public static final void _wglBindRenderbuffer(int target, IRenderbufferGL renderbuffer) {
|
||||
public static void _wglBindRenderbuffer(int target, IRenderbufferGL renderbuffer) {
|
||||
ctx.bindRenderbuffer(target,
|
||||
renderbuffer == null ? null : ((OpenGLObjects.RenderbufferGL)renderbuffer).ptr);
|
||||
}
|
||||
|
||||
public static final void _wglRenderbufferStorage(int target, int internalformat,
|
||||
public static void _wglRenderbufferStorage(int target, int internalformat,
|
||||
int width, int height) {
|
||||
ctx.renderbufferStorage(target, internalformat, width, height);
|
||||
}
|
||||
|
||||
public static final void _wglFramebufferRenderbuffer(int target, int attachment,
|
||||
public static void _wglFramebufferRenderbuffer(int target, int attachment,
|
||||
int renderbufferTarget, IRenderbufferGL renderbuffer) {
|
||||
ctx.framebufferRenderbuffer(target, attachment, renderbufferTarget,
|
||||
((OpenGLObjects.RenderbufferGL)renderbuffer).ptr);
|
||||
}
|
||||
|
||||
public static final String _wglGetString(int param) {
|
||||
public static String _wglGetString(int param) {
|
||||
if(hasWEBGLDebugRendererInfo) {
|
||||
String s;
|
||||
switch(param) {
|
||||
@ -759,47 +759,47 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final int _wglGetInteger(int param) {
|
||||
public static int _wglGetInteger(int param) {
|
||||
return ctx.getParameteri(param);
|
||||
}
|
||||
|
||||
public static final int _wglGetError() {
|
||||
public static int _wglGetError() {
|
||||
return ctx.getError();
|
||||
}
|
||||
|
||||
public static final int checkOpenGLESVersion() {
|
||||
public static int checkOpenGLESVersion() {
|
||||
return glesVers;
|
||||
}
|
||||
|
||||
public static final boolean checkEXTGPUShader5Capable() {
|
||||
public static boolean checkEXTGPUShader5Capable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static final boolean checkOESGPUShader5Capable() {
|
||||
public static boolean checkOESGPUShader5Capable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static final boolean checkFBORenderMipmapCapable() {
|
||||
public static boolean checkFBORenderMipmapCapable() {
|
||||
return glesVers >= 300 || hasOESFBORenderMipmap;
|
||||
}
|
||||
|
||||
public static final boolean checkVAOCapable() {
|
||||
public static boolean checkVAOCapable() {
|
||||
return vertexArrayImpl != VAO_IMPL_NONE;
|
||||
}
|
||||
|
||||
public static final boolean checkInstancingCapable() {
|
||||
public static boolean checkInstancingCapable() {
|
||||
return instancingImpl != INSTANCE_IMPL_NONE;
|
||||
}
|
||||
|
||||
public static final boolean checkTexStorageCapable() {
|
||||
public static boolean checkTexStorageCapable() {
|
||||
return glesVers >= 300;
|
||||
}
|
||||
|
||||
public static final boolean checkTextureLODCapable() {
|
||||
public static boolean checkTextureLODCapable() {
|
||||
return glesVers >= 300 || hasEXTShaderTextureLOD;
|
||||
}
|
||||
|
||||
public static final boolean checkHDRFramebufferSupport(int bits) {
|
||||
public static boolean checkHDRFramebufferSupport(int bits) {
|
||||
switch(bits) {
|
||||
case 16:
|
||||
return hasFBO16FSupport;
|
||||
@ -810,7 +810,7 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final boolean checkLinearHDRFilteringSupport(int bits) {
|
||||
public static boolean checkLinearHDRFilteringSupport(int bits) {
|
||||
switch(bits) {
|
||||
case 16:
|
||||
return hasLinearHDR16FSupport;
|
||||
@ -822,19 +822,19 @@ public class PlatformOpenGL {
|
||||
}
|
||||
|
||||
// legacy
|
||||
public static final boolean checkLinearHDR32FSupport() {
|
||||
public static boolean checkLinearHDR32FSupport() {
|
||||
return hasLinearHDR32FSupport;
|
||||
}
|
||||
|
||||
public static final boolean checkAnisotropicFilteringSupport() {
|
||||
public static boolean checkAnisotropicFilteringSupport() {
|
||||
return hasEXTTextureFilterAnisotropic;
|
||||
}
|
||||
|
||||
public static final boolean checkNPOTCapable() {
|
||||
public static boolean checkNPOTCapable() {
|
||||
return glesVers >= 300;
|
||||
}
|
||||
|
||||
private static final void checkErr(String name) {
|
||||
private static void checkErr(String name) {
|
||||
int i = ctx.getError();
|
||||
if(i != 0) {
|
||||
logger.error("########## GL ERROR ##########");
|
||||
@ -851,11 +851,11 @@ public class PlatformOpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
public static final String[] getAllExtensions() {
|
||||
public static String[] getAllExtensions() {
|
||||
return ctx.getSupportedExtensionArray();
|
||||
}
|
||||
|
||||
public static final void enterVAOEmulationHook() {
|
||||
public static void enterVAOEmulationHook() {
|
||||
WebGLBackBuffer.enterVAOEmulationPhase();
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package net.lax1dude.eaglercraft.v1_8.internal.teavm;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
||||
@ -184,7 +184,7 @@ public class EarlyLoadScreen {
|
||||
_wglUseProgram(program);
|
||||
_wglUniform2f(_wglGetUniformLocation(program, "aspect"), x, y);
|
||||
|
||||
IBufferArrayGL vao = null;
|
||||
IVertexArrayGL vao = null;
|
||||
if(vaos) {
|
||||
vao = _wglGenVertexArrays();
|
||||
_wglBindVertexArray(vao);
|
||||
@ -250,7 +250,7 @@ public class EarlyLoadScreen {
|
||||
|
||||
_wglUniform2f(_wglGetUniformLocation(program, "aspect"), x, y);
|
||||
|
||||
IBufferArrayGL vao = null;
|
||||
IVertexArrayGL vao = null;
|
||||
if(vaos) {
|
||||
vao = _wglGenVertexArrays();
|
||||
_wglBindVertexArray(vao);
|
||||
@ -324,11 +324,11 @@ public class EarlyLoadScreen {
|
||||
|
||||
_wglUniform2f(_wglGetUniformLocation(program, "aspect"), x, y);
|
||||
|
||||
IBufferArrayGL vao = null;
|
||||
IVertexArrayGL vao = null;
|
||||
if(vaos) {
|
||||
if(softVAOs) {
|
||||
vao = EaglercraftGPU.createGLBufferArray();
|
||||
EaglercraftGPU.bindGLBufferArray(vao);
|
||||
vao = EaglercraftGPU.createGLVertexArray();
|
||||
EaglercraftGPU.bindGLVertexArray(vao);
|
||||
}else {
|
||||
vao = _wglGenVertexArrays();
|
||||
_wglBindVertexArray(vao);
|
||||
@ -338,7 +338,7 @@ public class EarlyLoadScreen {
|
||||
EaglercraftGPU.bindVAOGLArrayBuffer(vbo);
|
||||
EaglercraftGPU.enableVertexAttribArray(0);
|
||||
EaglercraftGPU.vertexAttribPointer(0, 2, GL_FLOAT, false, 8, 0);
|
||||
EaglercraftGPU.doDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
EaglercraftGPU.drawArrays(GL_TRIANGLES, 0, 6);
|
||||
}else {
|
||||
_wglBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
_wglEnableVertexAttribArray(0);
|
||||
@ -367,7 +367,7 @@ public class EarlyLoadScreen {
|
||||
}
|
||||
if(vaos) {
|
||||
if(softVAOs) {
|
||||
EaglercraftGPU.destroyGLBufferArray(vao);
|
||||
EaglercraftGPU.destroyGLVertexArray(vao);
|
||||
}else {
|
||||
_wglDeleteVertexArrays(vao);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import org.teavm.jso.webgl.WebGLFramebuffer;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IVertexArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IFramebufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
@ -51,7 +51,7 @@ public class WebGLBackBuffer {
|
||||
private static ITextureGL gles2ColorTexture;
|
||||
private static IRenderbufferGL gles2DepthRenderbuffer;
|
||||
private static IProgramGL gles2BlitProgram;
|
||||
private static IBufferArrayGL gles2BlitVAO;
|
||||
private static IVertexArrayGL gles2BlitVAO;
|
||||
private static IBufferGL gles2BlitVBO;
|
||||
|
||||
private static boolean isVAOCapable = false;
|
||||
@ -61,8 +61,9 @@ public class WebGLBackBuffer {
|
||||
private static final int _GL_RENDERBUFFER = 0x8D41;
|
||||
private static final int _GL_COLOR_ATTACHMENT0 = 0x8CE0;
|
||||
private static final int _GL_DEPTH_ATTACHMENT = 0x8D00;
|
||||
private static final int _GL_DEPTH_COMPONENT16 = 0x81A5;
|
||||
private static final int _GL_DEPTH_STENCIL_ATTACHMENT = 0x821A;
|
||||
private static final int _GL_DEPTH_COMPONENT32F = 0x8CAC;
|
||||
private static final int _GL_DEPTH_STENCIL = 0x84F9;
|
||||
private static final int _GL_READ_FRAMEBUFFER = 0x8CA8;
|
||||
private static final int _GL_DRAW_FRAMEBUFFER = 0x8CA9;
|
||||
|
||||
@ -98,8 +99,8 @@ public class WebGLBackBuffer {
|
||||
_wglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, sw, sh, 0, GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer)null);
|
||||
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gles2ColorTexture, 0);
|
||||
_wglBindRenderbuffer(_GL_RENDERBUFFER, gles2DepthRenderbuffer);
|
||||
_wglRenderbufferStorage(_GL_RENDERBUFFER, _GL_DEPTH_COMPONENT16, sw, sh);
|
||||
_wglFramebufferRenderbuffer(_GL_FRAMEBUFFER, _GL_DEPTH_ATTACHMENT, _GL_RENDERBUFFER, gles2DepthRenderbuffer);
|
||||
_wglRenderbufferStorage(_GL_RENDERBUFFER, _GL_DEPTH_STENCIL, sw, sh);
|
||||
_wglFramebufferRenderbuffer(_GL_FRAMEBUFFER, _GL_DEPTH_STENCIL_ATTACHMENT, _GL_RENDERBUFFER, gles2DepthRenderbuffer);
|
||||
|
||||
ByteBuffer upload = PlatformRuntime.allocateByteBuffer(48);
|
||||
upload.putFloat(0.0f); upload.putFloat(0.0f);
|
||||
@ -160,8 +161,8 @@ public class WebGLBackBuffer {
|
||||
if(isVAOCapable) {
|
||||
_wglDeleteVertexArrays(gles2BlitVAO);
|
||||
}
|
||||
gles2BlitVAO = EaglercraftGPU.createGLBufferArray();
|
||||
EaglercraftGPU.bindGLBufferArray(gles2BlitVAO);
|
||||
gles2BlitVAO = EaglercraftGPU.createGLVertexArray();
|
||||
EaglercraftGPU.bindGLVertexArray(gles2BlitVAO);
|
||||
EaglercraftGPU.bindVAOGLArrayBuffer(gles2BlitVBO);
|
||||
EaglercraftGPU.enableVertexAttribArray(0);
|
||||
EaglercraftGPU.vertexAttribPointer(0, 2, GL_FLOAT, false, 8, 0);
|
||||
@ -172,8 +173,8 @@ public class WebGLBackBuffer {
|
||||
|
||||
private static void drawBlitQuad() {
|
||||
if(isEmulatedVAOPhase) {
|
||||
EaglercraftGPU.bindGLBufferArray(gles2BlitVAO);
|
||||
EaglercraftGPU.doDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
EaglercraftGPU.bindGLVertexArray(gles2BlitVAO);
|
||||
EaglercraftGPU.drawArrays(GL_TRIANGLES, 0, 6);
|
||||
}else {
|
||||
if(isVAOCapable) {
|
||||
_wglBindVertexArray(gles2BlitVAO);
|
||||
@ -237,7 +238,7 @@ public class WebGLBackBuffer {
|
||||
_wglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, windowWidth, windowHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer)null);
|
||||
|
||||
_wglBindRenderbuffer(_GL_RENDERBUFFER, gles2DepthRenderbuffer);
|
||||
_wglRenderbufferStorage(_GL_RENDERBUFFER, _GL_DEPTH_COMPONENT16, windowWidth, windowHeight);
|
||||
_wglRenderbufferStorage(_GL_RENDERBUFFER, _GL_DEPTH_STENCIL, windowWidth, windowHeight);
|
||||
}
|
||||
|
||||
if(isEmulatedVAOPhase) {
|
||||
@ -281,7 +282,7 @@ public class WebGLBackBuffer {
|
||||
}
|
||||
if(gles2BlitVAO != null) {
|
||||
if(isEmulatedVAOPhase) {
|
||||
EaglercraftGPU.destroyGLBufferArray(gles2BlitVAO);
|
||||
EaglercraftGPU.destroyGLVertexArray(gles2BlitVAO);
|
||||
}else if(isVAOCapable) {
|
||||
_wglDeleteVertexArrays(gles2BlitVAO);
|
||||
}
|
||||
|
@ -245,6 +245,10 @@ window.main = async function() {
|
||||
}
|
||||
}
|
||||
|
||||
if(assetsURI.startsWith("data:")) {
|
||||
delete window.eaglercraftXOpts.assetsURI;
|
||||
}
|
||||
|
||||
const rootElement = /** @type {HTMLElement} */ (document.getElementById(containerId));
|
||||
|
||||
if(!rootElement) {
|
||||
|
@ -51,13 +51,13 @@ class OpenGLObjects {
|
||||
|
||||
}
|
||||
|
||||
static class BufferArrayGL implements IBufferArrayGL {
|
||||
static class VertexArrayGL implements IVertexArrayGL {
|
||||
|
||||
private static int hashGen = 0;
|
||||
final WebGLVertexArray ptr;
|
||||
final int hash;
|
||||
|
||||
BufferArrayGL(WebGLVertexArray ptr) {
|
||||
VertexArrayGL(WebGLVertexArray ptr) {
|
||||
this.ptr = ptr;
|
||||
this.hash = ++hashGen;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user