diff options
author | tylermurphy534 <tylermurphy534@gmail.com> | 2022-09-20 22:02:58 -0400 |
---|---|---|
committer | tylermurphy534 <tylermurphy534@gmail.com> | 2022-09-20 22:02:58 -0400 |
commit | 249f6c9fa384e9e3265cafb1357e502ea7db72f7 (patch) | |
tree | 0c80d9a375453e9178dd5d45807302b00f57bd59 /engine/xe_engine.cpp | |
parent | destroy pipline layout (diff) | |
download | minecraftvulkan-249f6c9fa384e9e3265cafb1357e502ea7db72f7.tar.gz minecraftvulkan-249f6c9fa384e9e3265cafb1357e502ea7db72f7.tar.bz2 minecraftvulkan-249f6c9fa384e9e3265cafb1357e502ea7db72f7.zip |
texture loading
Diffstat (limited to '')
-rw-r--r-- | engine/xe_engine.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/engine/xe_engine.cpp b/engine/xe_engine.cpp index ea54bb4..6a971c9 100644 --- a/engine/xe_engine.cpp +++ b/engine/xe_engine.cpp @@ -1,4 +1,5 @@ #include "xe_engine.hpp" +#include "xe_image.hpp" #include <chrono> namespace xe { @@ -7,18 +8,15 @@ XeEngine::XeEngine(int width, int height, std::string name) : xeWindow{width, he xeDevice{xeWindow}, xeRenderer{xeWindow, xeDevice}, xeCamera{} { - loadDescriptors(); + loadDescriptorPool(); }; -void XeEngine::loadDescriptors() { +void XeEngine::loadDescriptorPool() { xeDescriptorPool = XeDescriptorPool::Builder(xeDevice) .setMaxSets(XeSwapChain::MAX_FRAMES_IN_FLIGHT) .addPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, XeSwapChain::MAX_FRAMES_IN_FLIGHT) .addPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, XeSwapChain::MAX_FRAMES_IN_FLIGHT) - .build(); - - xeDescriptorSetLayout = XeDescriptorSetLayout::Builder(xeDevice) - .addBinding(0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_VERTEX_BIT) + .addPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, XeSwapChain::MAX_FRAMES_IN_FLIGHT) .build(); } @@ -35,6 +33,10 @@ std::shared_ptr<XeModel> XeEngine::loadModelFromData(std::vector<XeModel::Vertex return std::make_shared<XeModel>(xeDevice, builder); } +std::shared_ptr<XeImage> XeEngine::loadImage(const std::string &filename) { + return std::make_shared<XeImage>(xeDevice, filename); +} + bool XeEngine::poll() { glfwPollEvents(); auto newTime = std::chrono::high_resolution_clock::now(); |