summaryrefslogtreecommitdiffstats
path: root/src/Data
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Obj3D/OpenGL.hs8
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]])