mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
Get depth buffer working
This commit is contained in:
parent
9e7c6e923d
commit
2f46fe21ef
@ -752,11 +752,12 @@ namespace engine {
|
|||||||
|
|
||||||
{ // RECORDING
|
{ // RECORDING
|
||||||
|
|
||||||
VkClearValue clearValue{}; // Using same value for all components enables compression according to NVIDIA Best Practices
|
std::array<VkClearValue, 2> clearValues{}; // Using same value for all components enables compression according to NVIDIA Best Practices
|
||||||
clearValue.color.float32[0] = 1.0f;
|
clearValues[0].color.float32[0] = 1.0f;
|
||||||
clearValue.color.float32[1] = 1.0f;
|
clearValues[0].color.float32[1] = 1.0f;
|
||||||
clearValue.color.float32[2] = 1.0f;
|
clearValues[0].color.float32[2] = 1.0f;
|
||||||
clearValue.color.float32[3] = 1.0f;
|
clearValues[0].color.float32[3] = 1.0f;
|
||||||
|
clearValues[1].depthStencil.depth = 1.0f;
|
||||||
|
|
||||||
VkRenderPassBeginInfo passBegin{};
|
VkRenderPassBeginInfo passBegin{};
|
||||||
passBegin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
passBegin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
||||||
@ -765,8 +766,8 @@ namespace engine {
|
|||||||
passBegin.framebuffer = std::get<2>(pimpl->swapchain.images[swapchainImageIndex]);
|
passBegin.framebuffer = std::get<2>(pimpl->swapchain.images[swapchainImageIndex]);
|
||||||
passBegin.renderArea.extent = pimpl->swapchain.extent;
|
passBegin.renderArea.extent = pimpl->swapchain.extent;
|
||||||
passBegin.renderArea.offset = { 0, 0 };
|
passBegin.renderArea.offset = { 0, 0 };
|
||||||
passBegin.clearValueCount = 1;
|
passBegin.clearValueCount = clearValues.size();
|
||||||
passBegin.pClearValues = &clearValue;
|
passBegin.pClearValues = clearValues.data();
|
||||||
vkCmdBeginRenderPass(frameData.drawBuf, &passBegin, VK_SUBPASS_CONTENTS_INLINE);
|
vkCmdBeginRenderPass(frameData.drawBuf, &passBegin, VK_SUBPASS_CONTENTS_INLINE);
|
||||||
|
|
||||||
VkViewport viewport{};
|
VkViewport viewport{};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <array>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -146,6 +147,7 @@ namespace engine {
|
|||||||
imageInfo.format = sc->depthStencil.format;
|
imageInfo.format = sc->depthStencil.format;
|
||||||
imageInfo.extent.width = sc->extent.width;
|
imageInfo.extent.width = sc->extent.width;
|
||||||
imageInfo.extent.height = sc->extent.height;
|
imageInfo.extent.height = sc->extent.height;
|
||||||
|
imageInfo.extent.depth = 1;
|
||||||
imageInfo.mipLevels = 1;
|
imageInfo.mipLevels = 1;
|
||||||
imageInfo.arrayLayers = 1;
|
imageInfo.arrayLayers = 1;
|
||||||
imageInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
imageInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
|
@ -153,7 +153,7 @@ void CameraControllerSystem::onUpdate(float ts)
|
|||||||
" y: " + std::to_string(t->position.y) +
|
" y: " + std::to_string(t->position.y) +
|
||||||
" z: " + std::to_string(t->position.z)
|
" z: " + std::to_string(t->position.z)
|
||||||
};
|
};
|
||||||
m_scene->app()->window()->infoBox("POSITION", pos_string);
|
//m_scene->app()->window()->infoBox("POSITION", pos_string);
|
||||||
LOG_INFO("position: " + pos_string);
|
LOG_INFO("position: " + pos_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user