iqm now gets read in more correctly

before only the first vertex/normal/.. was read in.
This commit is contained in:
Nicole Dresselhaus 2014-06-01 23:22:12 +02:00
parent eaeae7d4e2
commit ac832268ca
No known key found for this signature in database
GPG Key ID: BC16D887851A1A80

View File

@ -217,7 +217,7 @@ parseIQM a =
y -> error $ show y
-- Fill Vertex-Arrays with data of Offsets
let va = vertexArrays raw
va' <- mapM (readInVAO f) va
va' <- mapM (readInVAO f (num_vertexes.header $ raw)) va
vbo <- mapM toVBOfromVAO va
withVAO vao $ createVAO (zip va' vbo)
print raw
@ -267,11 +267,11 @@ toBufferTargetfromVAType _ = ArrayBuffer
--
-- Note: The String-Operations are O(1), so only O(numberOfCopiedBytes)
-- is needed in term of computation.
readInVAO :: ByteString -> IQMVertexArray -> IO IQMVertexArray
readInVAO d (IQMVertexArray type' a format num offset ptr) =
readInVAO :: ByteString -> Word32 -> IQMVertexArray -> IO IQMVertexArray
readInVAO d vcount (IQMVertexArray type' a format num offset ptr) =
do
let
byteLen = fromIntegral num * vaSize format
byteLen = fromIntegral vcount * fromIntegral num * vaSize format
data' = skipDrop (fromIntegral offset) byteLen d
unless (ptr == nullPtr) $ error $ "Error reading Vertex-Array: Double Read of " ++ show type'