39 lines
992 B
C++
39 lines
992 B
C++
|
#pragma once
|
||
|
#include "hk_device.hpp"
|
||
|
|
||
|
// libs
|
||
|
#define GLM_FORCE_RADIANS
|
||
|
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
||
|
#include <glm/glm.hpp>
|
||
|
|
||
|
#include <vector>
|
||
|
|
||
|
namespace hk{
|
||
|
class Model
|
||
|
{
|
||
|
public:
|
||
|
struct Vertex {
|
||
|
glm::vec2 posision;
|
||
|
glm::vec3 color;
|
||
|
|
||
|
static std::vector<VkVertexInputBindingDescription> getBindingDescriptions();
|
||
|
static std::vector<VkVertexInputAttributeDescription> getAttributeDescriptions();
|
||
|
};
|
||
|
|
||
|
Model(Device &device, const std::vector<Vertex> &vertices);
|
||
|
~Model();
|
||
|
|
||
|
Model(const Model &) = delete;
|
||
|
Model &operator=(const Model &) = delete;
|
||
|
|
||
|
void bind(VkCommandBuffer commandBuffer);
|
||
|
void draw(VkCommandBuffer commandBuffer);
|
||
|
private:
|
||
|
void createVertexBuffers(const std::vector<Vertex> &vertices);
|
||
|
|
||
|
Device &device;
|
||
|
VkBuffer vertexBuffer;
|
||
|
VkDeviceMemory vertexBufferMemory;
|
||
|
uint32_t vertexCount;
|
||
|
};
|
||
|
}
|