iqm now gets read in more correctly
before only the first vertex/normal/.. was read in.
This commit is contained in:
parent
eaeae7d4e2
commit
ac832268ca
@ -217,7 +217,7 @@ parseIQM a =
|
|||||||
y -> error $ show y
|
y -> error $ show y
|
||||||
-- Fill Vertex-Arrays with data of Offsets
|
-- Fill Vertex-Arrays with data of Offsets
|
||||||
let va = vertexArrays raw
|
let va = vertexArrays raw
|
||||||
va' <- mapM (readInVAO f) va
|
va' <- mapM (readInVAO f (num_vertexes.header $ raw)) va
|
||||||
vbo <- mapM toVBOfromVAO va
|
vbo <- mapM toVBOfromVAO va
|
||||||
withVAO vao $ createVAO (zip va' vbo)
|
withVAO vao $ createVAO (zip va' vbo)
|
||||||
print raw
|
print raw
|
||||||
@ -267,11 +267,11 @@ toBufferTargetfromVAType _ = ArrayBuffer
|
|||||||
--
|
--
|
||||||
-- Note: The String-Operations are O(1), so only O(numberOfCopiedBytes)
|
-- Note: The String-Operations are O(1), so only O(numberOfCopiedBytes)
|
||||||
-- is needed in term of computation.
|
-- is needed in term of computation.
|
||||||
readInVAO :: ByteString -> IQMVertexArray -> IO IQMVertexArray
|
readInVAO :: ByteString -> Word32 -> IQMVertexArray -> IO IQMVertexArray
|
||||||
readInVAO d (IQMVertexArray type' a format num offset ptr) =
|
readInVAO d vcount (IQMVertexArray type' a format num offset ptr) =
|
||||||
do
|
do
|
||||||
let
|
let
|
||||||
byteLen = fromIntegral num * vaSize format
|
byteLen = fromIntegral vcount * fromIntegral num * vaSize format
|
||||||
data' = skipDrop (fromIntegral offset) byteLen d
|
data' = skipDrop (fromIntegral offset) byteLen d
|
||||||
|
|
||||||
unless (ptr == nullPtr) $ error $ "Error reading Vertex-Array: Double Read of " ++ show type'
|
unless (ptr == nullPtr) $ error $ "Error reading Vertex-Array: Double Read of " ++ show type'
|
||||||
|
Loading…
Reference in New Issue
Block a user