minor cleanup
This commit is contained in:
parent
1e9c6a24fd
commit
32f1043d7c
@ -231,18 +231,18 @@ parseIQM a =
|
|||||||
|
|
||||||
createVAO :: [(IQMVertexArray, BufferObject)] -> IO ()
|
createVAO :: [(IQMVertexArray, BufferObject)] -> IO ()
|
||||||
createVAO bo = do
|
createVAO bo = do
|
||||||
print bo
|
print bo
|
||||||
initVAO (AttribLocation 0) IQMPosition bo
|
initVAO (AttribLocation 0) IQMPosition bo
|
||||||
initVAO (AttribLocation 1) IQMNormal bo
|
initVAO (AttribLocation 1) IQMNormal bo
|
||||||
initVAO (AttribLocation 2) IQMTexCoord bo
|
initVAO (AttribLocation 2) IQMTexCoord bo
|
||||||
|
|
||||||
initVAO :: AttribLocation -> IQMVertexArrayType -> [(IQMVertexArray, BufferObject)] -> IO ()
|
initVAO :: AttribLocation -> IQMVertexArrayType -> [(IQMVertexArray, BufferObject)] -> IO ()
|
||||||
initVAO l t bo = do
|
initVAO l t bo = do
|
||||||
print t
|
print $ concat ["adding ", show t, " to vertexBufferObject"]
|
||||||
let (IQMVertexArray _ _ _ num _ _,buf) = case filter (\(IQMVertexArray ty _ _ _ _ _, _) -> ty == t) bo of
|
let (IQMVertexArray _ _ _ num _ _,buf) = case filter (\(IQMVertexArray ty _ _ _ _ _, _) -> ty == t) bo of
|
||||||
[(a,b)] -> (a,b)
|
[(a,b)] -> (a,b)
|
||||||
_ -> error "IQM-Object not render-able with current shader-mechanics"
|
_ -> error "IQM-Object not render-able with current shader-mechanics"
|
||||||
bindBuffer (toBufferTargetfromVAType t)$= Just buf
|
bindBuffer (toBufferTargetfromVAType t) $= Just buf
|
||||||
vertexAttribArray l $= Enabled
|
vertexAttribArray l $= Enabled
|
||||||
vertexAttribPointer l $= (ToFloat, VertexArrayDescriptor num Float 0 nullPtr)
|
vertexAttribPointer l $= (ToFloat, VertexArrayDescriptor num Float 0 nullPtr)
|
||||||
|
|
||||||
|
@ -288,7 +288,9 @@ renderIQM :: IQM -> L.V3 CFloat -> L.V3 CFloat -> IO ()
|
|||||||
renderIQM m p@(L.V3 x y z) s@(L.V3 sx sy sz) = do
|
renderIQM m p@(L.V3 x y z) s@(L.V3 sx sy sz) = do
|
||||||
bindVertexArrayObject $= Just (vertexArrayObject m)
|
bindVertexArrayObject $= Just (vertexArrayObject m)
|
||||||
let n = num_vertexes.header $ m
|
let n = num_vertexes.header $ m
|
||||||
|
--print $ concat ["drawing ", show n," triangles from object ",show m]
|
||||||
glDrawArrays gl_TRIANGLES 0 (fromIntegral n)
|
glDrawArrays gl_TRIANGLES 0 (fromIntegral n)
|
||||||
|
checkError "drawing model"
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
renderObject :: MapObject -> IO ()
|
renderObject :: MapObject -> IO ()
|
||||||
|
Loading…
Reference in New Issue
Block a user