diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-01-03 15:30:03 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-01-03 15:30:03 +0100 |
commit | 015ebf1f5784c781b175ee0c338f95a3c7d3fe21 (patch) | |
tree | cfa3216ff5ad0c963d82c5b7622f91295db98f26 /src | |
parent | c8a67b6a5fe90e1ec3395ae61e5bcfce5cdf4d33 (diff) | |
download | obj-model-opengl-015ebf1f5784c781b175ee0c338f95a3c7d3fe21.tar obj-model-opengl-015ebf1f5784c781b175ee0c338f95a3c7d3fe21.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Data/Obj3D/OpenGL.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Data/Obj3D/OpenGL.hs b/src/Data/Obj3D/OpenGL.hs index 0e9b5c5..b126310 100644 --- a/src/Data/Obj3D/OpenGL.hs +++ b/src/Data/Obj3D/OpenGL.hs @@ -68,9 +68,11 @@ getIndex v = do makeVertexData :: ObjModel -> FaceVertex -> Interleaved makeVertexData model (v, t, n) = Interleaved tu (-tv) nx ny nz vx vy vz where - (vx, vy, vz) = genericIndex (objVertices model) v - (tu, tv) = if isJust t then genericIndex (objTexCoords model) $ fromJust t else (0, 0) - (nx, ny, nz) = if isJust n then genericIndex (objNormals model) $ fromJust n else (0, 0, 0) + (vx, vy, vz) = rtf3 $ genericIndex (objVertices model) v + (tu, tv) = rtf2 $ if isJust t then genericIndex (objTexCoords model) $ fromJust t else (0, 0) + (nx, ny, nz) = rtf3 $ if isJust n then genericIndex (objNormals model) $ fromJust n else (0, 0, 0) + rtf2 (x, y) = (realToFrac x, realToFrac y) + rtf3 (x, y, z) = (realToFrac x, realToFrac y, realToFrac z) interleaveObj :: ObjModel -> ([Interleaved], [[Integer]]) |