move matrix transposition into poke definition
This commit is contained in:
parent
455124021f
commit
82962d3350
3 changed files with 11 additions and 10 deletions
|
@ -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)))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue