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

@ -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
)

View file

@ -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
}
)
}