not changing to Data.Vector and staying on C-Array
- added Print-Function for Float-C-Arrays
This commit is contained in:
		@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user