call 0.1.4.1 → 0.1.4.2
raw patch · 5 files changed
+10/−24 lines, 5 files
Files
- call.cabal +1/−1
- shaders/fragment.glsl +1/−6
- shaders/vertex.glsl +1/−12
- src/Call/Internal/GLFW.hs +5/−3
- src/Call/System.hs +2/−2
call.cabal view
@@ -1,5 +1,5 @@ name: call-version: 0.1.4.1+version: 0.1.4.2 synopsis: The call game engine description: Call is a minimalistic game engine that supports 2D/3D graphics and sounds. homepage: https://github.com/fumieval/call
shaders/fragment.glsl view
@@ -1,4 +1,4 @@-#version 330+#version 150 out vec4 fragColor; // Texture@@ -14,8 +14,6 @@ uniform vec4 diffuse; uniform float normalMix; uniform float textureMix;-uniform float envAdd;-uniform float envMul; void main(void){ // vec3 n = mix(normal, texture(normalMap, UV).rgb * 2 - 1, normalMix);@@ -23,8 +21,5 @@ vec4 d = mix(vec4(1.0), texture(tex, UV).rgba, textureMix) * diffuse; fragColor = vec4(d.rgb, d.a);-- fragColor += texture(env, envUV).rgba * envAdd;- fragColor *= mix(vec4(1.0), texture(env, envUV).rgba, envMul); }
shaders/vertex.glsl view
@@ -1,4 +1,4 @@-#version 330+#version 150 uniform mat4 projection; uniform mat4 matrices[13]; uniform int level;@@ -8,8 +8,6 @@ in vec3 in_Position; in vec2 in_UV; in vec3 in_Normal;-out vec3 lightDir;-out vec3 normal; void main(void) { mat4 model = mat4(1.0);@@ -19,13 +17,4 @@ } gl_Position = projection * model * vec4(in_Position, 1.0); UV = in_UV;-- if(useEnv)- {- vec3 refl = reflect( normalize(vec3(model * vec4(in_Position, 1.0))), in_Normal );- float m = 2.0 * sqrt( refl.x*refl.x + refl.y*refl.y + (refl.z+1.0)*(refl.z+1.0) );- envUV = refl.xy / m + 0.5;- }- normal = in_Normal;- lightDir = vec3(0.0); }
src/Call/Internal/GLFW.hs view
@@ -22,6 +22,7 @@ import Linear import qualified Graphics.Rendering.OpenGL.Raw as GL import qualified Graphics.Rendering.OpenGL.GL as GL+import qualified Graphics.Rendering.OpenGL.GLU.Errors as GL import qualified Graphics.UI.GLFW as GLFW import Unsafe.Coerce import qualified Data.Vector.Storable as V@@ -32,7 +33,7 @@ import qualified Data.Text.IO as Text import qualified Data.Text.Encoding as Text import Foreign.C (CFloat)-import Foreign (nullPtr, plusPtr, sizeOf)+import Foreign import Paths_call data System = System { refRegion :: IORef (Box V2 Float)@@ -57,7 +58,7 @@ let siz = GL.TextureSize2D (gsizei w) (gsizei h) V.unsafeWith v $ GL.texImage2D GL.Texture2D GL.NoProxy 0 GL.RGBA8 siz 0- . GL.PixelData GL.ABGR GL.UnsignedInt8888+ . GL.PixelData GL.RGBA GL.UnsignedByte return (tex, fromIntegral w / 2, fromIntegral h / 2) releaseTexture :: Texture -> IO ()@@ -69,6 +70,7 @@ endFrame :: System -> IO Bool endFrame sys = do+ -- mapM_ print =<< GL.get GL.errors GLFW.swapBuffers $ theWindow sys GLFW.pollEvents GLFW.windowShouldClose (theWindow sys)@@ -86,7 +88,7 @@ _ -> return Nothing GLFW.windowHint $ GLFW.WindowHint'ContextVersionMajor 3- GLFW.windowHint $ GLFW.WindowHint'ContextVersionMinor 3+ GLFW.windowHint $ GLFW.WindowHint'ContextVersionMinor 2 GLFW.windowHint $ GLFW.WindowHint'OpenGLProfile GLFW.OpenGLProfile'Core GLFW.windowHint $ GLFW.WindowHint'OpenGLForwardCompat True
src/Call/System.hs view
@@ -408,8 +408,8 @@ withLoc "envAdd" $ \loc -> GL.glUniform1f loc 1 (tex, _, _) <- fetchTexture fo bmp h GL.activeTexture $= GL.TextureUnit 1- GL.textureFilter GL.Texture2D $= ((GL.Linear', Nothing), GL.Linear') GL.textureBinding GL.Texture2D $= Just tex+ GL.textureFilter GL.Texture2D $= ((GL.Linear', Nothing), GL.Linear') m c withLoc "useEnv" $ \loc -> GL.glUniform1i loc 0 withLoc "envAdd" $ \loc -> GL.glUniform1f loc 0@@ -420,8 +420,8 @@ (tex, _, _) <- fetchTexture fo bmp h GL.activeTexture $= GL.TextureUnit 1- GL.textureFilter GL.Texture2D $= ((GL.Linear', Nothing), GL.Linear') GL.textureBinding GL.Texture2D $= Just tex+ GL.textureFilter GL.Texture2D $= ((GL.Linear', Nothing), GL.Linear') m c withLoc "useEnv" $ \loc -> GL.glUniform1i loc 0 withLoc "envMul" $ \loc -> GL.glUniform1f loc 0