51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#include "renderer.hpp"
|
|
|
|
namespace gz::vk {
|
|
struct UniformBufferObject {
|
|
alignas(16) glm::mat4 model;
|
|
alignas(16) glm::mat4 view;
|
|
alignas(16) glm::mat4 projection;
|
|
};
|
|
|
|
|
|
const std::vector<Vertex3D> vertices2 = {
|
|
{{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 1.0f}, {0.0f, 0.0f}},
|
|
{{ 0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}},
|
|
{{ 0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}},
|
|
{{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 1.0f}},
|
|
|
|
{{-0.5f, -0.5f, -0.5f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f}},
|
|
{{ 0.5f, -0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}},
|
|
{{ 0.5f, 0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}},
|
|
{{-0.5f, 0.5f, -0.5f}, {1.0f, 1.0f, 1.0f}, {0.0f, 1.0f}},
|
|
|
|
};
|
|
/* const std::vector<Vertex> vertices = { */
|
|
/* {{-1.0f, -1.0f}, {0.0f, 0.0f, 1.0f}}, */
|
|
/* {{0.5f, 0.5f}, {0.0, 1.0f, 1.0f}}, */
|
|
/* {{-1.0, 0.0f}, {1.0f, 0.0f, 0.0f}}, */
|
|
/* {{1.0f, 1.0f}, {1.0f, 0.0f, 0.0f}}, */
|
|
/* {{-0.5f, -0.5f}, {0.0, 1.0f, 1.0f}}, */
|
|
/* {{1.0, 0.0f}, {1.0f, 0.0f, 1.0f}}, */
|
|
/* }; */
|
|
|
|
|
|
const std::vector<uint16_t> indices2 = {
|
|
0, 1, 2, 2, 3, 0,
|
|
4, 5, 6, 6, 7, 4
|
|
};
|
|
|
|
class Renderer3D : public Renderer {
|
|
public:
|
|
Renderer3D(VulkanInstance& instance);
|
|
void cleanup();
|
|
protected:
|
|
void recordCommandBuffer(uint32_t imageIndex, uint32_t currentFrame);
|
|
std::vector<VkBuffer> uniformBuffers;
|
|
std::vector<VkDeviceMemory> uniformBuffersMemory;
|
|
void updateUniformBuffer();
|
|
Log rLog;
|
|
};
|
|
|
|
}
|