fix obj loading

This commit is contained in:
nek0 2018-05-17 21:59:22 +02:00
parent 7d55809a3f
commit 5b026f74ae
10 changed files with 37 additions and 13 deletions

View file

@ -1,7 +1,5 @@
# Blender v2.79 (sub 0) OBJ File: 'smallsphere.blend'
# www.blender.org
mtllib smallsphere.mtl
o Icosphere
v 0.000000 -1.000000 0.000000
v 0.723600 -0.447215 0.525720
v -0.276385 -0.447215 0.850640
@ -34,7 +32,6 @@ vn -0.1876 0.7947 0.5774
vn -0.6071 0.7947 0.0000
vn -0.1876 0.7947 -0.5774
vn 0.4911 0.7947 -0.3568
usemtl None
s off
f 1//1 2//1 3//1
f 2//2 1//2 6//2

View file

@ -39,7 +39,7 @@ main =
}
, initScreenMode = SDL.Fullscreen
, preLoop = return ()
, eventLoop = handle
, eventLoop = mapM_ handle
, updateLoop = update
, drawLoop = draw
, loadState = load

View file

@ -39,7 +39,7 @@ main =
}
, initScreenMode = SDL.Fullscreen
, preLoop = return ()
, eventLoop = handle
, eventLoop = mapM_ handle
, updateLoop = update
, drawLoop = draw
, loadState = load

View file

@ -39,7 +39,7 @@ genVertBufObject path = do
GL.bindBuffer GL.ArrayBuffer $= Just verts
withArray (loTriangles lobj) $ \ptr ->
GL.bufferData GL.ArrayBuffer $=
( fromIntegral $ length (loTriangles lobj) * 3 * sizeOf (0 :: Double)
( fromIntegral $ length (loTriangles lobj) * sizeOf (0 :: Float)
, ptr
, GL.StaticDraw
)
@ -48,6 +48,8 @@ genVertBufObject path = do
, GL.VertexArrayDescriptor 4 GL.Float 0 (plusPtr nullPtr 0)
)
GL.vertexAttribArray (GL.AttribLocation 0) $= GL.Enabled
GL.bindBuffer GL.ArrayBuffer $= Nothing
GL.bindVertexArrayObject $= Nothing
return (shipBO, length (loTriangles lobj))
load :: IO StateData
@ -72,7 +74,7 @@ load = do
fragmentShader = foldl BS.append BS.empty
[ "varying vec2 f_texcoord;"
, "void main(void) {"
, " gl_FragColor = vec4(1,1,1,0.5);"
, " gl_FragColor = vec4(1.0,1.0,1.0,1.0);"
, "}"
]
p <- GLU.simpleShaderProgramBS vertexShader fragmentShader

View file

@ -34,12 +34,12 @@ main =
, windowConfig = SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1600 900
, SDL.windowOpenGL = Just SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 2
{ SDL.glProfile = SDL.Core SDL.Normal 3 0
}
}
, initScreenMode = SDL.Fullscreen
, preLoop = return ()
, eventLoop = handle
, eventLoop = mapM_ handle
, updateLoop = update
, drawLoop = draw
, loadState = load

View file

@ -70,7 +70,7 @@ main = do
}
, initScreenMode = SDL.Fullscreen
, preLoop = return ()
, eventLoop = handle
, eventLoop = mapM_ handle
, updateLoop = update
, drawLoop = draw (width o) (height o)
, loadState = load (width o) (height o)

View file

@ -137,7 +137,7 @@ executable example02
, GLUtil
, random
, vector
, wavefront
, wavefront >= 0.7.1.2
, shoot
hs-source-dirs: examples/example02
default-language: Haskell2010

View file

@ -6,3 +6,28 @@ research only in single player mode
Gather resources in multiplayer mode to spend them on for (very expensive)
research in singleplayer mode
## FTL technology
### Warp
Continuous drive, requires negative energy, rather stealthy
### Slingshot
Discrete drive, not stealthy at all, nomen est omen
ship gets accellerated to near lightspeed by internal means. Because of photons
"reflecting" from the ship it generate a characteristic radiation pattern, which
can be observed far and wide.
### Jump drive
Discrete drive, computation heavy, can be unreliable at targeting
### Gateways
Discrete drive, needs specialized structures/stations
### Tachyon sails
Continuous drive

View file

@ -39,7 +39,7 @@ main =
}
, initScreenMode = SDL.Fullscreen
, preLoop = return ()
, eventLoop = handle
, eventLoop = mapM_ handle
, updateLoop = update
, drawLoop = draw
, loadState = load