모델 로더 완성

This commit is contained in:
2025-05-19 03:28:51 +09:00
parent 3a9dbcb470
commit 0ea46b288d
13 changed files with 148 additions and 55 deletions

View File

@@ -0,0 +1,9 @@
#pragma once
#include "vulkan/texture_handle.h"
namespace veng {
struct Material {
TextureHandle texture;
};
} // namespace veng

View File

@@ -0,0 +1,27 @@
#pragma once
#include <vector>
#include "material.h"
#include "vulkan/graphics.h"
#include "vulkan/vertex.h"
#include <memory>
namespace veng {
struct Model {
Model(std::shared_ptr<class Graphics> graphics);
~Model();
std::vector<veng::Vertex> vertices;
veng::BufferHandle vertex_buffer;
std::vector<std::uint32_t> indices;
veng::BufferHandle index_buffer;
glm::mat4 transform;
Material material;
private:
std::weak_ptr<class Graphics> graphics_;
};
} // namespace veng

View File

@@ -1,7 +1,6 @@
#pragma once
struct GLFWmonitor;
struct GLFWwindow;
#include <GLFW/glfw3.h>
namespace veng {
class Window {
@@ -14,6 +13,8 @@ class Window {
bool ShouldClose() const;
GLFWwindow* GetHandle() const;
GLFWkeyfun SetKeyCallback(GLFWkeyfun key_callback);
bool TryMoveToMonitor(std::uint16_t monitor_number);
private:

View File

@@ -33,6 +33,7 @@ class Graphics final {
void RenderBuffer(BufferHandle handle, std::uint32_t vertex_count);
void RenderIndexedBuffer(BufferHandle vertex_buffer,
BufferHandle index_buffer, std::uint32_t count);
void RenderModel(struct Model& model);
void EndFrame();
BufferHandle CreateVertexBuffer(gsl::span<Vertex> vertices);

View File

@@ -1,12 +0,0 @@
#pragma once
#include <vector>
#include "vertex.h"
namespace veng {
struct Model {
std::vector<veng::Vertex> vertices;
std::vector<std::uint32_t> indices;
glm::mat4 transform;
};
} // namespace veng