diff --git a/src/CommandBuffer.hs b/src/CommandBuffer.hs index 7581c22..1d19335 100644 --- a/src/CommandBuffer.hs +++ b/src/CommandBuffer.hs @@ -107,10 +107,11 @@ createFrames physicalDevice logicalDevice allocator descriptorPool setLayout = d , Vk.range = fromIntegral $ sizeOf (GPUCameraData identity identity identity) } :: Vk.DescriptorBufferInfo setWrite = Vk.zero - { Vk.dstBinding = 0 - , Vk.dstSet = V.head globalDescriptor - , Vk.descriptorType = Vk.DESCRIPTOR_TYPE_UNIFORM_BUFFER - , Vk.bufferInfo = V.singleton bufferInfo + { Vk.dstBinding = 0 + , Vk.dstSet = V.head globalDescriptor + , Vk.descriptorCount = 1 + , Vk.descriptorType = Vk.DESCRIPTOR_TYPE_UNIFORM_BUFFER + , Vk.bufferInfo = V.singleton bufferInfo } Vk.updateDescriptorSets logicalDevice (V.singleton (Vk.SomeStruct setWrite)) V.empty @@ -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 ) diff --git a/src/Init.hs b/src/Init.hs index bff19bf..52a93c5 100644 --- a/src/Init.hs +++ b/src/Init.hs @@ -189,8 +189,8 @@ initDescriptors device = do , Vk.maxSets = 10 , Vk.poolSizes = V.singleton ( Vk.zero - { Vk.type' = Vk.DESCRIPTOR_TYPE_UNIFORM_BUFFER - , Vk.descriptorCount = 1 + { Vk.type' = Vk.DESCRIPTOR_TYPE_UNIFORM_BUFFER + , Vk.descriptorCount = 10 } ) }