Code cleanup, rename ui overlay property
This commit is contained in:
parent
9a8710a57c
commit
fb881ab76f
8 changed files with 69 additions and 69 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Vulkan Example - imGui (https://github.com/ocornut/imgui)
|
||||
*
|
||||
* Copyright (C) 2017-2023 by Sascha Willems - www.saschawillems.de
|
||||
* Copyright (C) 2017-2024 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
|
|
@ -61,9 +61,9 @@ public:
|
|||
|
||||
//SRS - Set ImGui font and style scale factors to handle retina and other HiDPI displays
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.FontGlobalScale = example->UIOverlay.scale;
|
||||
io.FontGlobalScale = example->ui.scale;
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
style.ScaleAllSizes(example->UIOverlay.scale);
|
||||
style.ScaleAllSizes(example->ui.scale);
|
||||
};
|
||||
|
||||
~ImGUI()
|
||||
|
|
@ -380,8 +380,8 @@ public:
|
|||
// Init imGui windows and elements
|
||||
|
||||
// Debug window
|
||||
ImGui::SetWindowPos(ImVec2(20 * example->UIOverlay.scale, 20 * example->UIOverlay.scale), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetWindowSize(ImVec2(300 * example->UIOverlay.scale, 300 * example->UIOverlay.scale), ImGuiSetCond_Always);
|
||||
ImGui::SetWindowPos(ImVec2(20 * example->ui.scale, 20 * example->ui.scale), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetWindowSize(ImVec2(300 * example->ui.scale, 300 * example->ui.scale), ImGuiSetCond_Always);
|
||||
ImGui::TextUnformatted(example->title.c_str());
|
||||
ImGui::TextUnformatted(device->properties.deviceName);
|
||||
|
||||
|
|
@ -409,8 +409,8 @@ public:
|
|||
ImGui::InputFloat3("rotation", &example->camera.rotation.x, 2);
|
||||
|
||||
// Example settings window
|
||||
ImGui::SetNextWindowPos(ImVec2(20 * example->UIOverlay.scale, 360 * example->UIOverlay.scale), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(300 * example->UIOverlay.scale, 200 * example->UIOverlay.scale), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowPos(ImVec2(20 * example->ui.scale, 360 * example->ui.scale), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(300 * example->ui.scale, 200 * example->ui.scale), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::Begin("Example settings");
|
||||
ImGui::Checkbox("Render models", &uiSettings.displayModels);
|
||||
ImGui::Checkbox("Display logos", &uiSettings.displayLogos);
|
||||
|
|
@ -638,7 +638,7 @@ public:
|
|||
}
|
||||
|
||||
// Render imGui
|
||||
if (UIOverlay.visible) {
|
||||
if (ui.visible) {
|
||||
imGui->drawFrame(drawCmdBuffers[i]);
|
||||
}
|
||||
|
||||
|
|
@ -794,9 +794,9 @@ public:
|
|||
io.DeltaTime = frameTimer;
|
||||
|
||||
io.MousePos = ImVec2(mouseState.position.x, mouseState.position.y);
|
||||
io.MouseDown[0] = mouseState.buttons.left && UIOverlay.visible;
|
||||
io.MouseDown[1] = mouseState.buttons.right && UIOverlay.visible;
|
||||
io.MouseDown[2] = mouseState.buttons.middle && UIOverlay.visible;
|
||||
io.MouseDown[0] = mouseState.buttons.left && ui.visible;
|
||||
io.MouseDown[1] = mouseState.buttons.right && ui.visible;
|
||||
io.MouseDown[2] = mouseState.buttons.middle && ui.visible;
|
||||
|
||||
draw();
|
||||
}
|
||||
|
|
@ -804,7 +804,7 @@ public:
|
|||
virtual void mouseMoved(double x, double y, bool &handled)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
handled = io.WantCaptureMouse && UIOverlay.visible;
|
||||
handled = io.WantCaptureMouse && ui.visible;
|
||||
}
|
||||
|
||||
// Input handling is platform specific, to show how it's basically done this sample implements it for Windows
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Vulkan Example - Using input attachments
|
||||
*
|
||||
* Copyright (C) 2018-2023 by Sascha Willems - www.saschawillems.de
|
||||
* Copyright (C) 2018-2024 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*
|
||||
|
|
@ -77,7 +77,7 @@ public:
|
|||
camera.setPosition(glm::vec3(1.65f, 1.75f, -6.15f));
|
||||
camera.setRotation(glm::vec3(-12.75f, 380.0f, 0.0f));
|
||||
camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 256.0f);
|
||||
UIOverlay.subpass = 1;
|
||||
ui.subpass = 1;
|
||||
}
|
||||
|
||||
~VulkanExample()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This sample shows how to do multisampled anti aliasing using built-in hardware via resolve attachments
|
||||
* These are special attachments that a multi-sampled is resolved to using a fixed sample pattern
|
||||
*
|
||||
* Copyright (C) 2016-2023 by Sascha Willems - www.saschawillems.de
|
||||
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
|
|
@ -508,7 +508,7 @@ public:
|
|||
void prepare()
|
||||
{
|
||||
sampleCount = getMaxAvailableSampleCount();
|
||||
UIOverlay.rasterizationSamples = sampleCount;
|
||||
ui.rasterizationSamples = sampleCount;
|
||||
VulkanExampleBase::prepare();
|
||||
loadAssets();
|
||||
prepareUniformBuffers();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Vulkan Example - Multi threaded command buffer generation and rendering
|
||||
*
|
||||
* Copyright (C) 2016-2023 by Sascha Willems - www.saschawillems.de
|
||||
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
|
|
@ -388,7 +388,7 @@ public:
|
|||
}
|
||||
|
||||
// Render ui last
|
||||
if (UIOverlay.visible) {
|
||||
if (ui.visible) {
|
||||
commandBuffers.push_back(secondaryCommandBuffers.ui);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Vulkan Example - Using subpasses for G-Buffer compositing
|
||||
*
|
||||
* Copyright (C) 2016-2023 by Sascha Willems - www.saschawillems.de
|
||||
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*
|
||||
|
|
@ -98,7 +98,7 @@ public:
|
|||
camera.setPosition(glm::vec3(-3.2f, 1.0f, 5.9f));
|
||||
camera.setRotation(glm::vec3(0.5f, 210.05f, 0.0f));
|
||||
camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 256.0f);
|
||||
UIOverlay.subpass = 2;
|
||||
ui.subpass = 2;
|
||||
}
|
||||
|
||||
~VulkanExample()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This sample renders a basic text overlay on top of a 3D scene that can be used e.g. for debug purposes
|
||||
* For a more complete GUI sample see the ImGui sample
|
||||
*
|
||||
* Copyright (C) 2016-2023 by Sascha Willems - www.saschawillems.de
|
||||
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
|
|
@ -535,23 +535,23 @@ public:
|
|||
|
||||
textOverlay->beginTextUpdate();
|
||||
|
||||
textOverlay->addText(title, 5.0f * UIOverlay.scale, 5.0f * UIOverlay.scale, TextOverlay::alignLeft);
|
||||
textOverlay->addText(title, 5.0f * ui.scale, 5.0f * ui.scale, TextOverlay::alignLeft);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << std::fixed << std::setprecision(2) << (frameTimer * 1000.0f) << "ms (" << lastFPS << " fps)";
|
||||
textOverlay->addText(ss.str(), 5.0f * UIOverlay.scale, 25.0f * UIOverlay.scale, TextOverlay::alignLeft);
|
||||
textOverlay->addText(ss.str(), 5.0f * ui.scale, 25.0f * ui.scale, TextOverlay::alignLeft);
|
||||
|
||||
textOverlay->addText(deviceProperties.deviceName, 5.0f * UIOverlay.scale, 45.0f * UIOverlay.scale, TextOverlay::alignLeft);
|
||||
textOverlay->addText(deviceProperties.deviceName, 5.0f * ui.scale, 45.0f * ui.scale, TextOverlay::alignLeft);
|
||||
|
||||
// Display current model view matrix
|
||||
textOverlay->addText("model view matrix", (float)width - 5.0f * UIOverlay.scale, 5.0f * UIOverlay.scale, TextOverlay::alignRight);
|
||||
textOverlay->addText("model view matrix", (float)width - 5.0f * ui.scale, 5.0f * ui.scale, TextOverlay::alignRight);
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++)
|
||||
{
|
||||
ss.str("");
|
||||
ss << std::fixed << std::setprecision(2) << std::showpos;
|
||||
ss << uniformData.modelView[0][i] << " " << uniformData.modelView[1][i] << " " << uniformData.modelView[2][i] << " " << uniformData.modelView[3][i];
|
||||
textOverlay->addText(ss.str(), (float)width - 5.0f * UIOverlay.scale, (25.0f + (float)i * 20.0f) * UIOverlay.scale, TextOverlay::alignRight);
|
||||
textOverlay->addText(ss.str(), (float)width - 5.0f * ui.scale, (25.0f + (float)i * 20.0f) * ui.scale, TextOverlay::alignRight);
|
||||
}
|
||||
|
||||
glm::vec3 projected = glm::project(glm::vec3(0.0f), uniformData.modelView, uniformData.projection, glm::vec4(0, 0, (float)width, (float)height));
|
||||
|
|
@ -559,8 +559,8 @@ public:
|
|||
|
||||
#if defined(__ANDROID__)
|
||||
#else
|
||||
textOverlay->addText("Press \"space\" to toggle text overlay", 5.0f * UIOverlay.scale, 65.0f * UIOverlay.scale, TextOverlay::alignLeft);
|
||||
textOverlay->addText("Hold middle mouse button and drag to move", 5.0f * UIOverlay.scale, 85.0f * UIOverlay.scale, TextOverlay::alignLeft);
|
||||
textOverlay->addText("Press \"space\" to toggle text overlay", 5.0f * ui.scale, 65.0f * ui.scale, TextOverlay::alignLeft);
|
||||
textOverlay->addText("Hold middle mouse button and drag to move", 5.0f * ui.scale, 85.0f * ui.scale, TextOverlay::alignLeft);
|
||||
#endif
|
||||
textOverlay->endTextUpdate();
|
||||
|
||||
|
|
@ -666,7 +666,7 @@ public:
|
|||
renderPass,
|
||||
&width,
|
||||
&height,
|
||||
UIOverlay.scale,
|
||||
ui.scale,
|
||||
shaderStages
|
||||
);
|
||||
updateTextOverlay();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue