vulkan animation

This commit is contained in:
Jorijn van der Graaf 2026-01-30 00:09:37 +01:00
commit db1616ff0e
4 changed files with 30 additions and 6 deletions

View file

@ -88,9 +88,22 @@ int main() {
*/
window.FinishInit();
EventListener<VkCommandBuffer> updateListener(&window.onRender, [&](VkCommandBuffer cmd){
std::cout << window.currentBuffer << std::endl;
RenderingElement3DVulkan::BuildTLAS(cmd, window.currentBuffer);
Animation<std::tuple<float>> anim({
{std::chrono::seconds(3), -600, 600},
});
anim.Start(std::chrono::high_resolution_clock::now());
EventListener<void> updateListener(&window.onRender, [&](){
float value = std::get<0>(anim.Play(window.currentFrameTime.now));
if(anim.currentFrame == anim.keyframes.size()) {
anim.Start(window.currentFrameTime.now);
}
MatrixRowMajor<float, 4, 3, 1> transform = MatrixRowMajor<float, 4, 3, 1>::Translation(value, 0, 0);
std::memcpy(el.instance.transform.matrix, transform.m, sizeof(transform.m));
RenderingElement3DVulkan::BuildTLAS(window.drawCmdBuffers[window.currentBuffer], window.currentBuffer);
VkDescriptorImageInfo imageInfo = {
.imageView = window.imageViews[window.currentBuffer],
.imageLayout = VK_IMAGE_LAYOUT_GENERAL
@ -123,7 +136,6 @@ int main() {
}
};
vkUpdateDescriptorSets(VulkanDevice::device, 2, write, 0, nullptr);
window.descriptorsRt[0] = pool.sets[window.currentBuffer];
});