From dafe16f191f99dc1199a5b386fad916a78c5c4f1 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 12 Apr 2010 14:40:31 +0200 Subject: Some improvements on coordinate calculation & player rendering --- src/Render.hs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/Render.hs') diff --git a/src/Render.hs b/src/Render.hs index 82ad08e..356310f 100644 --- a/src/Render.hs +++ b/src/Render.hs @@ -92,13 +92,6 @@ setup = do (lw, lh) <- gets (level . gameState) >>= \l -> return (fromIntegral . levelWidth $ l :: GLfloat, fromIntegral . levelHeight $ l :: GLfloat) liftIO $ do - matrixMode $= Projection - scale 1 1 (0.1 :: GLfloat) - translate $ Vector3 (lw/2) (lh/2) 0 - rotate (-30) $ Vector3 1 0 (0 :: GLfloat) - translate $ Vector3 (-lw/2) (-lh/2) 0 - matrixMode $= Modelview 0 - blend $= Enabled blendFunc $= (SrcAlpha, OneMinusSrcAlpha) depthFunc $= Just Lequal @@ -144,6 +137,8 @@ render = do liftIO $ do clear [ColorBuffer, DepthBuffer] + depthFunc $= Just Lequal + texture Texture2D $= Enabled textureBinding Texture2D $= Just textureWood @@ -224,23 +219,26 @@ render = do y = realToFrac . bulletY $ bullet rotDir = realToFrac . bulletDir $ bullet - translate $ Vector3 x y (0 :: GLfloat) + translate $ Vector3 x y (0.1 :: GLfloat) + rotate 30 $ Vector3 1 0 (0 :: GLfloat) rotate rotDir $ Vector3 0 0 (1 :: GLfloat) textureBinding Texture2D $= Just textureBullet unsafeRenderPrimitive Quads $ do texCoord $ TexCoord2 (0 :: GLfloat) (0 :: GLfloat) - vertex $ Vertex3 (-0.1 :: GLfloat) (-0.1 :: GLfloat) 0.01 + vertex $ Vertex3 (-0.1 :: GLfloat) (-0.1 :: GLfloat) 0 texCoord $ TexCoord2 (0 :: GLfloat) (1 :: GLfloat) - vertex $ Vertex3 (-0.1 :: GLfloat) (0.1 :: GLfloat) 0.01 + vertex $ Vertex3 (-0.1 :: GLfloat) (0.1 :: GLfloat) 0 texCoord $ TexCoord2 (1 :: GLfloat) (1 :: GLfloat) - vertex $ Vertex3 (0.1 :: GLfloat) (0.1 :: GLfloat) 0.01 + vertex $ Vertex3 (0.1 :: GLfloat) (0.1 :: GLfloat) 0 texCoord $ TexCoord2 (1 :: GLfloat) (0 :: GLfloat) - vertex $ Vertex3 (0.1 :: GLfloat) (-0.1 :: GLfloat) 0.01 + vertex $ Vertex3 (0.1 :: GLfloat) (-0.1 :: GLfloat) 0 + + depthFunc $= Just Always textureBinding Texture2D $= Just textureCrosshair forM_ playerlist renderPlayer -- cgit v1.2.3