Add Texture loading and extend original functionality! this needs HEAVY documentation, which I will do tomorrow.
This commit is contained in:
15
src/global.h
15
src/global.h
@@ -30,6 +30,9 @@ namespace Global {
|
||||
extern VkDescriptorSetLayout descriptorSetLayout;
|
||||
extern uint32_t currentFrame;
|
||||
extern std::vector<VkDescriptorSet> descriptorSets;
|
||||
extern VkImageView textureImageView;
|
||||
extern VkSampler textureSampler;
|
||||
|
||||
struct UniformBufferObject {
|
||||
float time;
|
||||
alignas(16) glm::mat4 model;
|
||||
@@ -39,7 +42,8 @@ namespace Global {
|
||||
struct Vertex {
|
||||
glm::vec2 pos;
|
||||
glm::vec3 color;
|
||||
|
||||
glm::vec2 texCoord;
|
||||
|
||||
static VkVertexInputBindingDescription getBindingDescription() {
|
||||
VkVertexInputBindingDescription bindingDescription{};
|
||||
bindingDescription.binding = 0;
|
||||
@@ -48,8 +52,8 @@ namespace Global {
|
||||
|
||||
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;
|
||||
@@ -60,6 +64,11 @@ namespace Global {
|
||||
attributeDescriptions[1].location = 1;
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user