모델 로더 완성
This commit is contained in:
9
include/asset/object/material.h
Normal file
9
include/asset/object/material.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "vulkan/texture_handle.h"
|
||||
|
||||
namespace veng {
|
||||
struct Material {
|
||||
TextureHandle texture;
|
||||
};
|
||||
} // namespace veng
|
||||
27
include/asset/object/model.h
Normal file
27
include/asset/object/model.h
Normal 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
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user