diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2010-04-12 16:17:41 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2010-04-12 16:17:41 +0200 |
commit | 08762ddc9ac9be5a4a63b1d15b3955ceb27f76b2 (patch) | |
tree | bb4f2f36cd4fc5c230744d44bdd40aa3e4badaa8 /src/Render.hs | |
parent | dafe16f191f99dc1199a5b386fad916a78c5c4f1 (diff) | |
download | htanks-08762ddc9ac9be5a4a63b1d15b3955ceb27f76b2.tar htanks-08762ddc9ac9be5a4a63b1d15b3955ceb27f76b2.zip |
Simplified texture and model loading; also use crosshair for DefaultPlayer
Diffstat (limited to 'src/Render.hs')
-rw-r--r-- | src/Render.hs | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/src/Render.hs b/src/Render.hs index 356310f..32173c1 100644 --- a/src/Render.hs +++ b/src/Render.hs @@ -3,7 +3,6 @@ module Render ( setup ) where -import Paths_htanks import Game import MainLoop import Level @@ -36,18 +35,6 @@ import Graphics.Rendering.OpenGL.GL.Texturing.Specification (TextureTarget(..)) import Graphics.Rendering.OpenGL.GL.VertexArrays (clientState, ClientArrayType(..)) import Graphics.Rendering.OpenGL.GL.VertexSpec -import Foreign.ForeignPtr -import Foreign.Marshal.Array - - -texturePath :: Texture -> IO FilePath -texturePath t = getDataFileName $ path t - where - path TextureWood = "tex/Wood.png" - path TextureTank = "tex/Tank.png" - path TextureCannon = "tex/Cannon.png" - path TextureBullet = "tex/Bullet.png" - path TextureCrosshair = "tex/Crosshair.png" getTexture :: Texture -> Main TextureObject getTexture t = do @@ -63,11 +50,6 @@ getTexture t = do modify $ \state -> state {textures = M.insert t tex ts} return tex -modelPath :: Model -> IO FilePath -modelPath t = getDataFileName $ path t - where - path ModelTank = "model/tank.obj" - getModel :: Model -> Main InterleavedObj getModel m = do ms <- gets models @@ -176,19 +158,6 @@ render = do rotate 90 $ Vector3 1 0 (0 :: GLfloat) drawObject modelTank 1 - {-unsafeRenderPrimitive Quads $ do - texCoord $ TexCoord2 (0 :: GLfloat) (0 :: GLfloat) - vertex $ Vertex2 (-0.5 :: GLfloat) (-0.5 :: GLfloat) - - texCoord $ TexCoord2 (0 :: GLfloat) (1 :: GLfloat) - vertex $ Vertex2 (-0.5 :: GLfloat) (0.5 :: GLfloat) - - texCoord $ TexCoord2 (1 :: GLfloat) (1 :: GLfloat) - vertex $ Vertex2 (0.5 :: GLfloat) (0.5 :: GLfloat) - - texCoord $ TexCoord2 (1 :: GLfloat) (0 :: GLfloat) - vertex $ Vertex2 (0.5 :: GLfloat) (-0.5 :: GLfloat)-} - rotate (rotAim-rotDir) $ Vector3 0 0 (1 :: GLfloat) --textureBinding Texture2D $= Just textureCannon @@ -196,22 +165,7 @@ render = do unsafePreservingMatrix $ do rotate 90 $ Vector3 1 0 (0 :: GLfloat) drawObject modelTank 0 - - - {-unsafeRenderPrimitive Quads $ do - texCoord $ TexCoord2 (0 :: GLfloat) (0 :: GLfloat) - vertex $ Vertex2 (-0.5 :: GLfloat) (-0.5 :: GLfloat) - - texCoord $ TexCoord2 (0 :: GLfloat) (1 :: GLfloat) - vertex $ Vertex2 (-0.5 :: GLfloat) (0.5 :: GLfloat) - - texCoord $ TexCoord2 (1 :: GLfloat) (1 :: GLfloat) - vertex $ Vertex2 (0.5 :: GLfloat) (0.5 :: GLfloat) - - texCoord $ TexCoord2 (1 :: GLfloat) (0 :: GLfloat) - vertex $ Vertex2 (0.5 :: GLfloat) (-0.5 :: GLfloat)-} - texture Texture2D $= Enabled forM_ bulletlist $ \bullet -> unsafePreservingMatrix $ do @@ -219,7 +173,7 @@ render = do y = realToFrac . bulletY $ bullet rotDir = realToFrac . bulletDir $ bullet - translate $ Vector3 x y (0.1 :: GLfloat) + translate $ Vector3 x y (0.2 :: GLfloat) rotate 30 $ Vector3 1 0 (0 :: GLfloat) rotate rotDir $ Vector3 0 0 (1 :: GLfloat) |