New texture and small changes for runtime mip map generation example

This commit is contained in:
saschawillems 2016-08-27 14:03:13 +02:00
parent 81fc142053
commit 6c3a597002
2 changed files with 5 additions and 6 deletions

View file

@ -67,7 +67,7 @@ public:
glm::mat4 view; glm::mat4 view;
glm::mat4 model; glm::mat4 model;
float lodBias = 0.0f; float lodBias = 0.0f;
float samplerIndex = 1.0f; float samplerIndex = 2.0f;
} uboVS; } uboVS;
struct { struct {
@ -80,15 +80,15 @@ public:
VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
{ {
title = "Vulkan Example - Texturing"; title = "Vulkan Example - Runtime mip map generation";
enableTextOverlay = true; enableTextOverlay = true;
camera.type = Camera::CameraType::firstperson; camera.type = Camera::CameraType::firstperson;
camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 512.0f); camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 512.0f);
camera.setRotation(glm::vec3(0.0f, 90.0f, 0.0f)); camera.setRotation(glm::vec3(0.0f, 90.0f, 0.0f));
camera.setTranslation(glm::vec3(10.0f, 0.0f, 0.0f)); camera.setTranslation(glm::vec3(10.75f, 0.0f, 0.0f));
camera.movementSpeed = 2.5f; camera.movementSpeed = 2.5f;
camera.rotationSpeed = 0.5f; camera.rotationSpeed = 0.5f;
timerSpeed *= 0.15f; timerSpeed *= 0.05f;
paused = true; paused = true;
} }
@ -664,12 +664,10 @@ public:
{ {
uboVS.projection = camera.matrices.perspective; uboVS.projection = camera.matrices.perspective;
uboVS.view = camera.matrices.view; uboVS.view = camera.matrices.view;
if (!paused) if (!paused)
{ {
uboVS.model = glm::rotate(glm::mat4(), glm::radians(timer * 360.0f), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(glm::mat4(), glm::radians(timer * 360.0f), glm::vec3(1.0f, 0.0f, 0.0f));
} }
VK_CHECK_RESULT(uniformBufferVS.map()); VK_CHECK_RESULT(uniformBufferVS.map());
memcpy(uniformBufferVS.mapped, &uboVS, sizeof(uboVS)); memcpy(uniformBufferVS.mapped, &uboVS, sizeof(uboVS));
uniformBufferVS.unmap(); uniformBufferVS.unmap();
@ -724,6 +722,7 @@ public:
{ {
uboVS.samplerIndex = (uboVS.samplerIndex < static_cast<uint32_t>(samplers.size()) - 1) ? uboVS.samplerIndex + 1 : 0; uboVS.samplerIndex = (uboVS.samplerIndex < static_cast<uint32_t>(samplers.size()) - 1) ? uboVS.samplerIndex + 1 : 0;
updateUniformBuffers(); updateUniformBuffers();
updateTextOverlay();
} }
virtual void keyPressed(uint32_t keyCode) virtual void keyPressed(uint32_t keyCode)