diff --git a/src/CommandBuffer.hs b/src/CommandBuffer.hs index 1748988..e6be19d 100644 --- a/src/CommandBuffer.hs +++ b/src/CommandBuffer.hs @@ -224,7 +224,7 @@ recordCommandBuffer let constants = MeshPushConstants { meshPushData = V4 0 0 0 0 - , meshRenderMatrix = transpose modelMatrix + , meshRenderMatrix = modelMatrix } mesh = meshMap M.! meshID material = materialMap M.! materialID @@ -323,7 +323,7 @@ pokeData frame frameNumber sceneParameters cameraParameters = do V.mapM_ (\(index, obj) -> do - let modelMatrix = GPUObjectData (transpose $ objectMatrix obj) + let modelMatrix = GPUObjectData (objectMatrix obj) liftIO $ poke (castPtr objectPointer `plusPtr` (index * sizeOf (undefined :: GPUObjectData))) diff --git a/src/Draw.hs b/src/Draw.hs index 79e2b06..17fbaff 100644 --- a/src/Draw.hs +++ b/src/Draw.hs @@ -68,9 +68,9 @@ drawFrame engineData frameNumber = do 0.1 200 cameraData = GPUCameraData - { view = transpose camView - , projection = transpose camProjection - , viewProjection = transpose $ camProjection !*! camView + { view = camView + , projection = camProjection + , viewProjection = camProjection !*! camView } pokeData diff --git a/src/Types.hs b/src/Types.hs index 9e5358d..781677b 100644 --- a/src/Types.hs +++ b/src/Types.hs @@ -220,7 +220,7 @@ instance Storable GPUObjectData where GPUObjectData <$> peek (castPtr ptr) poke ptr (GPUObjectData modelMatrix) = - poke (castPtr ptr) modelMatrix + poke (castPtr ptr) $ transpose modelMatrix data GPUCameraData = GPUCameraData { view :: M44 Float @@ -231,7 +231,7 @@ data GPUCameraData = GPUCameraData instance Storable GPUCameraData where sizeOf _ = - 3* sizeOf (undefined :: M44 Float) + 3 * sizeOf (undefined :: M44 Float) alignment _ = 0 @@ -242,9 +242,10 @@ instance Storable GPUCameraData where return $ GPUCameraData v p vp poke ptr (GPUCameraData pview pprojection pviewProjection) = do - poke (castPtr ptr) pview - poke (castPtr ptr `plusPtr` sizeOf pview) pprojection - poke (castPtr ptr `plusPtr` sizeOf pview `plusPtr` sizeOf pprojection) pviewProjection + poke (castPtr ptr) $ transpose pview + poke (castPtr ptr `plusPtr` sizeOf pview) $ transpose pprojection + poke (castPtr ptr `plusPtr` sizeOf pview `plusPtr` sizeOf pprojection) $ + transpose pviewProjection data GPUSceneData = GPUSceneData { fogColor :: V4 Float