make it work

This commit is contained in:
nek0 2023-01-17 05:35:57 +01:00
parent e8e37f1ced
commit f2af2a8ccf
2 changed files with 20 additions and 16 deletions

View file

@ -109,6 +109,7 @@ createFrames physicalDevice logicalDevice allocator descriptorPool setLayout = d
setWrite = Vk.zero
{ Vk.dstBinding = 0
, Vk.dstSet = V.head globalDescriptor
, Vk.descriptorCount = 1
, Vk.descriptorType = Vk.DESCRIPTOR_TYPE_UNIFORM_BUFFER
, Vk.bufferInfo = V.singleton bufferInfo
}
@ -210,16 +211,19 @@ recordCommandBuffer
V.mapM_
(\(RenderObject meshID materialID modelMatrix) -> do
let camPosition = V3 0 0 (-10)
let camPosition = V3
(-10 * sin (fromIntegral frameNumber / 90))
(-2)
(-10 * cos (fromIntegral frameNumber / 90))
camCenter = V3 0 0 0
camUp = V3 0 1 0
camView = lookAt camPosition camCenter camUp
camProjection = perspective (pi/4) (1280 / 1024) 0.1 200
camProjection = perspective (pi/4) (fromIntegral width / fromIntegral height) 0.1 200
cameraData = GPUCameraData
{ view = camView
, projection = camProjection
, viewProjection = camProjection !*! camView
{ view = transpose camView
, projection = transpose camProjection
, viewProjection = transpose $ camProjection !*! camView
}
-- pvm = projection !*! view !*! modelMatrix
@ -256,11 +260,11 @@ recordCommandBuffer
(fromIntegral $ sizeOf constants)
dataPointer
-- Vk.cmdBindVertexBuffers
-- commandBuffer
-- 0
-- (V.fromList [ allocatedBuffer $ meshBuffer mesh ])
-- (V.fromList [ 0 ])
Vk.cmdBindVertexBuffers
commandBuffer
0
(V.fromList [ allocatedBuffer $ meshBuffer mesh ])
(V.fromList [ 0 ])
Vk.cmdDraw commandBuffer (fromIntegral $ V.length $ meshVertices mesh) 1 0 0
)

View file

@ -190,7 +190,7 @@ initDescriptors device = do
, Vk.poolSizes = V.singleton
( Vk.zero
{ Vk.type' = Vk.DESCRIPTOR_TYPE_UNIFORM_BUFFER
, Vk.descriptorCount = 1
, Vk.descriptorCount = 10
}
)
}