fix obj loading
This commit is contained in:
parent
7d55809a3f
commit
5b026f74ae
10 changed files with 37 additions and 13 deletions
|
@ -1,7 +1,5 @@
|
||||||
# Blender v2.79 (sub 0) OBJ File: 'smallsphere.blend'
|
# Blender v2.79 (sub 0) OBJ File: 'smallsphere.blend'
|
||||||
# www.blender.org
|
# www.blender.org
|
||||||
mtllib smallsphere.mtl
|
|
||||||
o Icosphere
|
|
||||||
v 0.000000 -1.000000 0.000000
|
v 0.000000 -1.000000 0.000000
|
||||||
v 0.723600 -0.447215 0.525720
|
v 0.723600 -0.447215 0.525720
|
||||||
v -0.276385 -0.447215 0.850640
|
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.6071 0.7947 0.0000
|
||||||
vn -0.1876 0.7947 -0.5774
|
vn -0.1876 0.7947 -0.5774
|
||||||
vn 0.4911 0.7947 -0.3568
|
vn 0.4911 0.7947 -0.3568
|
||||||
usemtl None
|
|
||||||
s off
|
s off
|
||||||
f 1//1 2//1 3//1
|
f 1//1 2//1 3//1
|
||||||
f 2//2 1//2 6//2
|
f 2//2 1//2 6//2
|
||||||
|
|
|
@ -39,7 +39,7 @@ main =
|
||||||
}
|
}
|
||||||
, initScreenMode = SDL.Fullscreen
|
, initScreenMode = SDL.Fullscreen
|
||||||
, preLoop = return ()
|
, preLoop = return ()
|
||||||
, eventLoop = handle
|
, eventLoop = mapM_ handle
|
||||||
, updateLoop = update
|
, updateLoop = update
|
||||||
, drawLoop = draw
|
, drawLoop = draw
|
||||||
, loadState = load
|
, loadState = load
|
||||||
|
|
|
@ -39,7 +39,7 @@ main =
|
||||||
}
|
}
|
||||||
, initScreenMode = SDL.Fullscreen
|
, initScreenMode = SDL.Fullscreen
|
||||||
, preLoop = return ()
|
, preLoop = return ()
|
||||||
, eventLoop = handle
|
, eventLoop = mapM_ handle
|
||||||
, updateLoop = update
|
, updateLoop = update
|
||||||
, drawLoop = draw
|
, drawLoop = draw
|
||||||
, loadState = load
|
, loadState = load
|
||||||
|
|
|
@ -39,7 +39,7 @@ genVertBufObject path = do
|
||||||
GL.bindBuffer GL.ArrayBuffer $= Just verts
|
GL.bindBuffer GL.ArrayBuffer $= Just verts
|
||||||
withArray (loTriangles lobj) $ \ptr ->
|
withArray (loTriangles lobj) $ \ptr ->
|
||||||
GL.bufferData GL.ArrayBuffer $=
|
GL.bufferData GL.ArrayBuffer $=
|
||||||
( fromIntegral $ length (loTriangles lobj) * 3 * sizeOf (0 :: Double)
|
( fromIntegral $ length (loTriangles lobj) * sizeOf (0 :: Float)
|
||||||
, ptr
|
, ptr
|
||||||
, GL.StaticDraw
|
, GL.StaticDraw
|
||||||
)
|
)
|
||||||
|
@ -48,6 +48,8 @@ genVertBufObject path = do
|
||||||
, GL.VertexArrayDescriptor 4 GL.Float 0 (plusPtr nullPtr 0)
|
, GL.VertexArrayDescriptor 4 GL.Float 0 (plusPtr nullPtr 0)
|
||||||
)
|
)
|
||||||
GL.vertexAttribArray (GL.AttribLocation 0) $= GL.Enabled
|
GL.vertexAttribArray (GL.AttribLocation 0) $= GL.Enabled
|
||||||
|
GL.bindBuffer GL.ArrayBuffer $= Nothing
|
||||||
|
GL.bindVertexArrayObject $= Nothing
|
||||||
return (shipBO, length (loTriangles lobj))
|
return (shipBO, length (loTriangles lobj))
|
||||||
|
|
||||||
load :: IO StateData
|
load :: IO StateData
|
||||||
|
@ -72,7 +74,7 @@ load = do
|
||||||
fragmentShader = foldl BS.append BS.empty
|
fragmentShader = foldl BS.append BS.empty
|
||||||
[ "varying vec2 f_texcoord;"
|
[ "varying vec2 f_texcoord;"
|
||||||
, "void main(void) {"
|
, "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
|
p <- GLU.simpleShaderProgramBS vertexShader fragmentShader
|
||||||
|
|
|
@ -34,12 +34,12 @@ main =
|
||||||
, windowConfig = SDL.defaultWindow
|
, windowConfig = SDL.defaultWindow
|
||||||
{ SDL.windowInitialSize = SDL.V2 1600 900
|
{ SDL.windowInitialSize = SDL.V2 1600 900
|
||||||
, SDL.windowOpenGL = Just SDL.defaultOpenGL
|
, SDL.windowOpenGL = Just SDL.defaultOpenGL
|
||||||
{ SDL.glProfile = SDL.Core SDL.Normal 3 2
|
{ SDL.glProfile = SDL.Core SDL.Normal 3 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, initScreenMode = SDL.Fullscreen
|
, initScreenMode = SDL.Fullscreen
|
||||||
, preLoop = return ()
|
, preLoop = return ()
|
||||||
, eventLoop = handle
|
, eventLoop = mapM_ handle
|
||||||
, updateLoop = update
|
, updateLoop = update
|
||||||
, drawLoop = draw
|
, drawLoop = draw
|
||||||
, loadState = load
|
, loadState = load
|
||||||
|
|
|
@ -70,7 +70,7 @@ main = do
|
||||||
}
|
}
|
||||||
, initScreenMode = SDL.Fullscreen
|
, initScreenMode = SDL.Fullscreen
|
||||||
, preLoop = return ()
|
, preLoop = return ()
|
||||||
, eventLoop = handle
|
, eventLoop = mapM_ handle
|
||||||
, updateLoop = update
|
, updateLoop = update
|
||||||
, drawLoop = draw (width o) (height o)
|
, drawLoop = draw (width o) (height o)
|
||||||
, loadState = load (width o) (height o)
|
, loadState = load (width o) (height o)
|
||||||
|
|
2
hw.cabal
2
hw.cabal
|
@ -137,7 +137,7 @@ executable example02
|
||||||
, GLUtil
|
, GLUtil
|
||||||
, random
|
, random
|
||||||
, vector
|
, vector
|
||||||
, wavefront
|
, wavefront >= 0.7.1.2
|
||||||
, shoot
|
, shoot
|
||||||
hs-source-dirs: examples/example02
|
hs-source-dirs: examples/example02
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
|
@ -6,3 +6,28 @@ research only in single player mode
|
||||||
|
|
||||||
Gather resources in multiplayer mode to spend them on for (very expensive)
|
Gather resources in multiplayer mode to spend them on for (very expensive)
|
||||||
research in singleplayer mode
|
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
|
||||||
|
|
|
@ -39,7 +39,7 @@ main =
|
||||||
}
|
}
|
||||||
, initScreenMode = SDL.Fullscreen
|
, initScreenMode = SDL.Fullscreen
|
||||||
, preLoop = return ()
|
, preLoop = return ()
|
||||||
, eventLoop = handle
|
, eventLoop = mapM_ handle
|
||||||
, updateLoop = update
|
, updateLoop = update
|
||||||
, drawLoop = draw
|
, drawLoop = draw
|
||||||
, loadState = load
|
, loadState = load
|
||||||
|
|
Loading…
Reference in a new issue