not changing to Data.Vector and staying on C-Array

- added Print-Function for Float-C-Arrays
This commit is contained in:
Nicole Dresselhaus 2014-06-10 22:59:48 +02:00
parent d8747c0bd3
commit 4bbf80ecab
No known key found for this signature in database
GPG Key ID: BC16D887851A1A80
2 changed files with 7 additions and 1 deletions

View File

@ -276,7 +276,7 @@ readInVAO d vcount (IQMVertexArray type' a format num offset ptr) =
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'
p <- mallocBytes byteLen p <- mallocBytes byteLen
putStrLn $ concat ["Allocating ", show num,"x",show (vaSize format)," = ", show byteLen, " Bytes at ", show p, " for ", show type'] putStrLn $ concat ["Allocating ", show vcount ,"x", show num,"x",show (vaSize format)," = ", show byteLen, " Bytes at ", show p, " for ", show type']
putStrLn $ concat ["Filling with: ", show data', " starting at ", show offset] putStrLn $ concat ["Filling with: ", show data', " starting at ", show offset]
unsafeUseAsCString data' (\s -> copyBytes p s byteLen) unsafeUseAsCString data' (\s -> copyBytes p s byteLen)
return $ IQMVertexArray type' a format num offset $ castPtr p return $ IQMVertexArray type' a format num offset $ castPtr p

View File

@ -121,6 +121,12 @@ getCam (x',z') dist' xa' ya' = lookAt (cpos ^+^ at') at' up
xa = realToFrac xa' xa = realToFrac xa'
ya = realToFrac ya'-} ya = realToFrac ya'-}
-- | Prints any Pointer as Float-Array with given number of elements.
printPtrAsFloatArray :: Ptr a -> Int -> IO ()
printPtrAsFloatArray pointer num = do
a <- peekArray num (castPtr pointer :: Ptr Float)
print a
curb :: Ord a => a -> a -> a -> a curb :: Ord a => a -> a -> a -> a
curb l h x curb l h x
| x < l = l | x < l = l