diff --git a/include/vkcv/VertexLayout.hpp b/include/vkcv/VertexLayout.hpp index ef40ef6c03c8e4ccef80874d683c42f9aefedb77..247bb478afaaaddb82377894b3b18d5dea8e14fe 100644 --- a/include/vkcv/VertexLayout.hpp +++ b/include/vkcv/VertexLayout.hpp @@ -44,10 +44,11 @@ uint32_t getFormatSize(VertexFormat format); struct VertexInputAttachment{ VertexInputAttachment() = delete; - VertexInputAttachment(uint32_t location, uint32_t binding, VertexFormat format, uint32_t offset) noexcept; + VertexInputAttachment(uint32_t location, uint32_t binding, std::string name, VertexFormat format, uint32_t offset) noexcept; uint32_t location; uint32_t binding; + std::string name; VertexFormat format; uint32_t offset; }; diff --git a/modules/asset_loader/src/vkcv/asset/asset_loader.cpp b/modules/asset_loader/src/vkcv/asset/asset_loader.cpp index f9539dcba4a8c63b0f122888745485e1ff2b5afb..b7604092c24e61c64a7b5fe2bc6478901e3b799e 100644 --- a/modules/asset_loader/src/vkcv/asset/asset_loader.cpp +++ b/modules/asset_loader/src/vkcv/asset/asset_loader.cpp @@ -167,11 +167,11 @@ int loadMesh(const std::string &path, Mesh &mesh) { IndexType indexType; switch(indexAccessor.componentType) { case fx::gltf::Accessor::ComponentType::UnsignedByte: - indexType = UINT8; break; + indexType = IndexType::UINT8; break; case fx::gltf::Accessor::ComponentType::UnsignedShort: - indexType = UINT16; break; + indexType = IndexType::UINT16; break; case fx::gltf::Accessor::ComponentType::UnsignedInt: - indexType = UINT32; break; + indexType = IndexType::UINT32; break; default: vkcv_log(LogLevel::ERROR, "Index type (%u) not supported", static_cast<uint16_t>(indexAccessor.componentType)); diff --git a/projects/cmd_sync_test/src/main.cpp b/projects/cmd_sync_test/src/main.cpp index 2494793f3b4aff3dfa412ff9bbe27e4550ca8fe0..4c77e6aefa3bd2edda0220798633db87ee737d3c 100644 --- a/projects/cmd_sync_test/src/main.cpp +++ b/projects/cmd_sync_test/src/main.cpp @@ -33,10 +33,10 @@ int main(int argc, const char** argv) { { "VK_KHR_swapchain" } ); - vkcv::asset::Mesh mesh; + vkcv::asset::Scene mesh; const char* path = argc > 1 ? argv[1] : "resources/cube/cube.gltf"; - int result = vkcv::asset::loadMesh(path, mesh); + int result = vkcv::asset::loadScene(path, mesh); if (result == 1) { std::cout << "Mesh loading successful!" << std::endl; @@ -121,8 +121,11 @@ int main(int argc, const char** argv) { return EXIT_FAILURE; } - vkcv::Image texture = core.createImage(vk::Format::eR8G8B8A8Srgb, mesh.texture_hack.w, mesh.texture_hack.h); - texture.fill(mesh.texture_hack.img); + //vkcv::Image texture = core.createImage(vk::Format::eR8G8B8A8Srgb, mesh.texture_hack.w, mesh.texture_hack.h); + //texture.fill(mesh.texture_hack.img); + vkcv::asset::Texture &tex = mesh.textures[0]; + vkcv::Image texture = core.createImage(vk::Format::eR8G8B8A8Srgb, tex.w, tex.h); + texture.fill(tex.data.data()); vkcv::SamplerHandle sampler = core.createSampler( vkcv::SamplerFilterType::LINEAR, diff --git a/projects/first_mesh/src/main.cpp b/projects/first_mesh/src/main.cpp index 469c70ed12b0c6aae37bd772efd24611d5909d72..611ab6cc91450e109bb06c1b5c7dcf2802259d7c 100644 --- a/projects/first_mesh/src/main.cpp +++ b/projects/first_mesh/src/main.cpp @@ -103,7 +103,7 @@ int main(int argc, const char** argv) { UINT32_MAX, UINT32_MAX, trianglePass, - mesh.vertexGroups[0].vertexBuffer.attributes, + mesh.vertexGroups[2].vertexBuffer.attributes, { core.getDescriptorSet(descriptorSet).layout }, true); vkcv::PipelineHandle trianglePipeline = core.createGraphicsPipeline(trianglePipelineDefinition); @@ -127,9 +127,9 @@ int main(int argc, const char** argv) { ); const std::vector<vkcv::VertexBufferBinding> vertexBufferBindings = { - vkcv::VertexBufferBinding( mesh.vertexGroups[0].vertexBuffer.attributes[0].offset, vertexBuffer.getVulkanHandle() ), - vkcv::VertexBufferBinding( mesh.vertexGroups[0].vertexBuffer.attributes[1].offset, vertexBuffer.getVulkanHandle() ), - vkcv::VertexBufferBinding( mesh.vertexGroups[0].vertexBuffer.attributes[2].offset, vertexBuffer.getVulkanHandle() ) + vkcv::VertexBufferBinding( mesh.vertexGroups[2].vertexBuffer.attributes[0].offset, vertexBuffer.getVulkanHandle() ), + vkcv::VertexBufferBinding( mesh.vertexGroups[2].vertexBuffer.attributes[1].offset, vertexBuffer.getVulkanHandle() ), + vkcv::VertexBufferBinding( mesh.vertexGroups[2].vertexBuffer.attributes[2].offset, vertexBuffer.getVulkanHandle() ) }; vkcv::DescriptorWrites setWrites; @@ -141,7 +141,7 @@ int main(int argc, const char** argv) { const vkcv::ImageHandle swapchainInput = vkcv::ImageHandle::createSwapchainImageHandle(); - const vkcv::Mesh renderMesh(vertexBufferBindings, indexBuffer.getVulkanHandle(), mesh.vertexGroups[0].numIndices); + const vkcv::Mesh renderMesh(vertexBufferBindings, indexBuffer.getVulkanHandle(), mesh.vertexGroups[2].numIndices); vkcv::DescriptorSetUsage descriptorUsage(0, core.getDescriptorSet(descriptorSet).vulkanHandle); vkcv::DrawcallInfo drawcall(renderMesh, { descriptorUsage });