changed rect order

This commit is contained in:
matthias@arch 2022-10-21 21:59:35 +02:00
parent 79c0a7393a
commit 3a6ce0217a

View File

@ -3,6 +3,8 @@
#include "shape.hpp" #include "shape.hpp"
#include "vulkan_instance.hpp" #include "vulkan_instance.hpp"
#include "renderer2D.hpp" #include "renderer2D.hpp"
#include "renderer3D.hpp"
#include <chrono> #include <chrono>
#include <ratio> #include <ratio>
#include <thread> #include <thread>
@ -31,15 +33,15 @@ namespace gz::vk {
log("Startup complete. Drawing shapes"); log("Startup complete. Drawing shapes");
Rectangle rect9(-200, -400, 200, 200, { 0.0f, 1.0f, 0.0f}, "entities/sheep.png");
Rectangle rect1( 90, 91, 92, 93, { 1.0f, 0.9f, 0.8f}, "blocks/leaves.png"); Rectangle rect1( 90, 91, 92, 93, { 1.0f, 0.9f, 0.8f}, "blocks/leaves.png");
Rectangle rect2( 190, 191, 192, 193, { 0.7f, 0.6f, 0.5f}, "blocks/crate.png"); Rectangle rect2( 190, 191, 192, 193, { 0.7f, 0.6f, 0.5f}, "blocks/crate.png");
Rectangle rect3( 32, 120, 400, 400, { 0.0f, 0.0f, 1.0f}, "blocks/dirt.png"); Rectangle rect3( 32, 120, 400, 400, { 0.0f, 0.0f, 1.0f}, "blocks/dirt.png");
Rectangle rect4(-600, -600, 800, 400, { 1.0f, 0.0f, 0.0f}, "blocks/ice.png");
Rectangle rect5( 90, 91, 92, 93, { 1.0f, 0.9f, 0.8f}, "items/sword.png"); Rectangle rect5( 90, 91, 92, 93, { 1.0f, 0.9f, 0.8f}, "items/sword.png");
Rectangle rect6( 190, 191, 192, 193, { 0.7f, 0.6f, 0.5f}, "items/crossbow.png"); Rectangle rect6( 190, 191, 192, 193, { 0.7f, 0.6f, 0.5f}, "items/crossbow.png");
Rectangle rect4(-600, -600, 800, 400, { 1.0f, 0.0f, 0.0f}, "blocks/ice.png");
Rectangle rect7( 32, 120, 400, 400, { 0.0f, 0.0f, 1.0f}, "special/hotbar.png"); Rectangle rect7( 32, 120, 400, 400, { 0.0f, 0.0f, 1.0f}, "special/hotbar.png");
Rectangle rect8(-600, -600, 800, 400, { 1.0f, 0.0f, 0.0f}, "special/func_nocol.png"); Rectangle rect8(-600, -600, 800, 400, { 1.0f, 0.0f, 0.0f}, "special/func_nocol.png");
Rectangle rect9(-200, -400, 200, 200, { 0.0f, 1.0f, 0.0f}, "entities/sheep.png");
Rectangle rect10(-400, -400, 800, 800, { 0.0f, 1.0f, 0.0f}, "atlas"); Rectangle rect10(-400, -400, 800, 800, { 0.0f, 1.0f, 0.0f}, "atlas");
r2D.drawShape(&rect1); r2D.drawShape(&rect1);
r2D.drawShape(&rect2); r2D.drawShape(&rect2);
@ -54,6 +56,8 @@ namespace gz::vk {
log("Drawing complete. Filling r2D with shapes."); log("Drawing complete. Filling r2D with shapes.");
r2D.fillVertexBufferWithShapes(); r2D.fillVertexBufferWithShapes();
r2D.fillIndexBufferWithShapes(); r2D.fillIndexBufferWithShapes();
Renderer3D r3D(vulkanInstance, textureManager);
/* gz::FontManager fm("fonts"); */ /* gz::FontManager fm("fonts"); */
/* fm.loadFont("menu.ttf"); */ /* fm.loadFont("menu.ttf"); */
/* /1* fm.getFaces().at("menu.ttf"). *1/ */ /* /1* fm.getFaces().at("menu.ttf"). *1/ */
@ -64,6 +68,7 @@ namespace gz::vk {
glfwPollEvents(); glfwPollEvents();
imageIndex = vulkanInstance.beginFrameDraw(); imageIndex = vulkanInstance.beginFrameDraw();
r2D.drawFrame(imageIndex); r2D.drawFrame(imageIndex);
r3D.drawFrame(imageIndex);
vulkanInstance.endFrameDraw(imageIndex); vulkanInstance.endFrameDraw(imageIndex);
auto SLEEP_TIME = std::chrono::milliseconds(1000 / vulkanInstance.settings.get<uint32_t>("framerate")); auto SLEEP_TIME = std::chrono::milliseconds(1000 / vulkanInstance.settings.get<uint32_t>("framerate"));
std::this_thread::sleep_for(SLEEP_TIME); std::this_thread::sleep_for(SLEEP_TIME);