Image is projected onto the sqaure now
This commit is contained in:
+14
-6
@@ -34,17 +34,20 @@ namespace vapp{
|
||||
struct Vertex{
|
||||
glm::vec2 pos;
|
||||
glm::vec3 color;
|
||||
glm::vec2 texCoord;
|
||||
|
||||
static VkVertexInputBindingDescription getBindingDescription(){
|
||||
VkVertexInputBindingDescription bindingDescription{};
|
||||
|
||||
bindingDescription.binding = 0;
|
||||
bindingDescription.stride = sizeof(Vertex);
|
||||
bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
|
||||
|
||||
return bindingDescription;
|
||||
}
|
||||
|
||||
static std::array<VkVertexInputAttributeDescription, 2> getAttributeDescriptions(){
|
||||
std::array<VkVertexInputAttributeDescription, 2> attributeDescriptions{};
|
||||
static std::array<VkVertexInputAttributeDescription, 3> getAttributeDescriptions(){
|
||||
std::array<VkVertexInputAttributeDescription, 3> attributeDescriptions{};
|
||||
|
||||
attributeDescriptions[0].binding = 0;
|
||||
attributeDescriptions[0].location = 0;
|
||||
@@ -56,16 +59,21 @@ namespace vapp{
|
||||
attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[1].offset = offsetof(Vertex, color);
|
||||
|
||||
attributeDescriptions[2].binding = 0;
|
||||
attributeDescriptions[2].location = 2;
|
||||
attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT;
|
||||
attributeDescriptions[2].offset = offsetof(Vertex, texCoord);
|
||||
|
||||
return attributeDescriptions;
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Remove
|
||||
const std::vector<Vertex> vertices = {
|
||||
{{-0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}},
|
||||
{{0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}},
|
||||
{{0.5f, 0.5f}, {0.0f, 1.0f, 0.0f}},
|
||||
{{-0.5f, 0.5f}, {1.0f, 0.0f, 0.0f}}
|
||||
{{-0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}},
|
||||
{{0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}, {0.0f, 0.0f}},
|
||||
{{0.5f, 0.5f}, {0.0f, 1.0f, 0.0f}, {0.0f, 1.0f}},
|
||||
{{-0.5f, 0.5f}, {1.0f, 0.0f, 0.0f}, {1.0f, 1.0f}}
|
||||
};
|
||||
|
||||
// uint16_t also possible -> change in vkCmdBindIndexBuffer also
|
||||
|
||||
Reference in New Issue
Block a user