diff --git a/README.md b/README.md index 8b7810e19..da0cdbfd4 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Requires 64 bit processor and operation system. |OS|Windows 7/macOS Sierra/Ubuntu 16.04|Windows 10/macOS Big Sur/Linux with Kernel 5.4| |CPU|AMD Phenom X4 9600/Intel Core 2 Duo E8400|AMD Ryzen 5 1500X/Intel Core i7-4770K/Apple M1| |Memory|4 GB RAM|8 GB RAM| -|OpenGL|3.2|4.0| +|OpenGL|3.3|4.0| |Graphics|GeForce 9600 GT|Anything that supports OpenGL 4.0| |Storage|2 GB available|2 GB available but faster| diff --git a/src/net/torvald/terrarum/App.java b/src/net/torvald/terrarum/App.java index 430462f49..cfabd7061 100644 --- a/src/net/torvald/terrarum/App.java +++ b/src/net/torvald/terrarum/App.java @@ -1671,8 +1671,8 @@ public class App implements ApplicationListener { frag = "#version 400\n"+frag0; } else { - vert = "#version 150\n#define fma(a,b,c) (((a)*(b))+(c))\n"+vert0; - frag = "#version 150\n#define fma(a,b,c) (((a)*(b))+(c))\n"+frag0; + vert = "#version 330\n#define fma(a,b,c) (((a)*(b))+(c))\n"+vert0; + frag = "#version 330\n#define fma(a,b,c) (((a)*(b))+(c))\n"+frag0; } ShaderProgram s = new ShaderProgram(vert, frag); diff --git a/src/net/torvald/terrarum/TerrarumGLinfo.kt b/src/net/torvald/terrarum/TerrarumGLinfo.kt index 75054bbb5..bbd6d54e5 100644 --- a/src/net/torvald/terrarum/TerrarumGLinfo.kt +++ b/src/net/torvald/terrarum/TerrarumGLinfo.kt @@ -7,7 +7,7 @@ import org.lwjgl.opengl.GL11 class TerrarumGLinfo { private var _initialised = false - val MINIMAL_GL_VERSION = 320 + val MINIMAL_GL_VERSION = 330 var GL_VERSION = -1; private set get() = if (_initialised) field else throw UninitializedPropertyAccessException() diff --git a/src/net/torvald/terrarum/weather/WeatherObjectCloud.kt b/src/net/torvald/terrarum/weather/WeatherObjectCloud.kt index 87f2c2e16..ce8569ead 100644 --- a/src/net/torvald/terrarum/weather/WeatherObjectCloud.kt +++ b/src/net/torvald/terrarum/weather/WeatherObjectCloud.kt @@ -78,6 +78,13 @@ class WeatherObjectCloud( private val vecMult = Vector3(1f, 1f, 1f / (4f * H)) + private fun packFloat(f: Float, g: Float): Float { + val fi = java.lang.Float.floatToRawIntBits(f) + val gi = java.lang.Float.floatToRawIntBits(g) + val hi = (fi and 0xffff0000.toInt()) or ((gi and 0xffff0000.toInt()) ushr 16) + return java.lang.Float.intBitsToFloat(hi) + } + fun render(batch: UnpackedColourSpriteBatch, cloudDrawColour0: Color, shadiness: Float) { val sc = screenCoord @@ -87,7 +94,7 @@ class WeatherObjectCloud( it.a = alpha } batch.color = cloudCol - batch.generic.set(rgbGamma, aGamma, shadiness, 0f) + batch.generic.set(packFloat(rgbGamma, aGamma), shadiness, 0f, 0f) if (flipW) batch.draw(texture, sc.x + texture.regionWidth / posZ, sc.y, -texture.regionWidth * sc.z, texture.regionHeight * sc.z) diff --git a/src/shaders/clouds.frag b/src/shaders/clouds.frag index 54963e4b1..e3f266250 100644 --- a/src/shaders/clouds.frag +++ b/src/shaders/clouds.frag @@ -2,7 +2,7 @@ in vec4 v_color; // lightCol -in vec4 v_generic; // [rgb gamma, a gamma, shadiness, 0] +in vec4 v_generic; // [rgb gamma + a gamma, shadiness, 0, 0] in vec2 v_texCoords; uniform sampler2D u_texture; out vec4 fragColor; @@ -16,9 +16,9 @@ vec4 shadeVec = vec4(1.0 + 3.333 * v_generic.z, 1.0 + 3.333 * v_generic.z, 1.0 + void main() { vec4 cloudCol = v_color; - float rgbGamma = v_generic.x; - float aGamma = v_generic.y; - vec4 gamma = v_generic.xxxy; + float rgbGamma = uintBitsToFloat(floatBitsToUint(v_generic.x) & 0xffff0000u); + float aGamma = uintBitsToFloat((floatBitsToUint(v_generic.x) & 0x0000ffffu) << 16); + vec4 gamma = vec4(rgbGamma, rgbGamma, rgbGamma, aGamma); vec4 range = vec4(vec3(min(rgbGamma, 1.0 / rgbGamma)), 1.0); vec4 offset = vec4(vec3(max(0.0, 1.0 - rgbGamma)), 0.0);