Pass elapsed time to renderer and use for time UBO
This commit is contained in:
parent
f594d28fde
commit
e723636f9a
|
|
@ -483,6 +483,7 @@ void VulkanRenderer::recordCommandBuffer(VkCommandBuffer commandBuffer,
|
|||
uint32_t imageIndex,
|
||||
VkImageView imageView,
|
||||
int frameCount,
|
||||
double elapsedTime,
|
||||
double rotationAngle,
|
||||
double wavePhase,
|
||||
bool paintingEnabled,
|
||||
|
|
@ -553,7 +554,7 @@ void VulkanRenderer::recordCommandBuffer(VkCommandBuffer commandBuffer,
|
|||
}
|
||||
|
||||
// Update uniform buffer
|
||||
m_ubo.time = static_cast<float>(frameCount);
|
||||
m_ubo.time = static_cast<float>(elapsedTime);
|
||||
m_ubo.resolution[0] = static_cast<float>(m_width);
|
||||
m_ubo.resolution[1] = static_cast<float>(m_height);
|
||||
m_ubo.rotation = static_cast<float>(rotationAngle);
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ public:
|
|||
* @param imageIndex 交换链图像索引
|
||||
* @param imageView 交换链图像视图
|
||||
* @param frameCount 当前帧数
|
||||
* @param elapsedTime 运行时间(秒)
|
||||
* @param rotationAngle 旋转角度
|
||||
* @param wavePhase 波浪相位
|
||||
* @param paintingEnabled 是否启用绘制
|
||||
|
|
@ -112,6 +113,7 @@ public:
|
|||
uint32_t imageIndex,
|
||||
VkImageView imageView,
|
||||
int frameCount,
|
||||
double elapsedTime,
|
||||
double rotationAngle,
|
||||
double wavePhase,
|
||||
bool paintingEnabled,
|
||||
|
|
|
|||
|
|
@ -866,8 +866,13 @@ void VulkanWidget::recordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t i
|
|||
.arg(m_lockCount);
|
||||
}
|
||||
|
||||
// Calculate elapsed time in seconds
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
qint64 elapsedTime = m_startTime.secsTo(now);
|
||||
|
||||
m_renderer->recordCommandBuffer(commandBuffer, imageIndex, imageView,
|
||||
m_frameCount, m_rotationAngle, m_wavePhase,
|
||||
m_frameCount, static_cast<double>(elapsedTime),
|
||||
m_rotationAngle, m_wavePhase,
|
||||
m_renderingEnabled, lockInfo.toStdString());
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue