#include "vertex.hpp" #include #include #include namespace gz::vk { const uint32_t BINDING = 0; template VkFormat getVkFormat() { if (std::same_as) { return VK_FORMAT_R32G32B32_SFLOAT; } else if (std::same_as) { return VK_FORMAT_R32G32_SFLOAT; } } // // 3D VERTEX // template std::string Vertex::toString() const { return "pos: <" + gz::toString(pos) + ", color: " + gz::toString(color) + ", texCoords: " + gz::toString(texCoord) + ">"; }; template VkVertexInputBindingDescription Vertex::getBindingDescription() { VkVertexInputBindingDescription bindingD{}; bindingD.binding = BINDING; bindingD.stride = sizeof(Vertex); bindingD.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; return bindingD; } template std::array Vertex::getAttributeDescriptions() { std::array inputAttributeD{}; inputAttributeD[0].binding = BINDING; inputAttributeD[0].location = 0; inputAttributeD[0].format = getVkFormat(); inputAttributeD[0].offset = offsetof(Vertex, pos); inputAttributeD[1].binding = BINDING; inputAttributeD[1].location = 1; inputAttributeD[1].format = VK_FORMAT_R32G32B32_SFLOAT; inputAttributeD[1].offset = offsetof(Vertex, color); inputAttributeD[2].binding = BINDING; inputAttributeD[2].location = 2; inputAttributeD[2].format = VK_FORMAT_R32G32_SFLOAT; inputAttributeD[2].offset = offsetof(Vertex, texCoord); return inputAttributeD; } template bool Vertex::operator==(const Vertex& other) const { return pos == other.pos and color == other.color and texCoord == other.texCoord; } template std::string Vertex::toString() const; template std::string Vertex::toString() const; template VkVertexInputBindingDescription Vertex::getBindingDescription(); template VkVertexInputBindingDescription Vertex::getBindingDescription(); template std::array Vertex::getAttributeDescriptions(); template std::array Vertex::getAttributeDescriptions(); template bool Vertex::operator==(const Vertex& other) const; template bool Vertex::operator==(const Vertex& other) const; } // namespace gz::vk