Files
tanks-reborn/source/game/model.hpp
2026-04-01 12:16:59 -03:00

47 lines
826 B
C++

#ifndef TANKS_MODEL_HPP
#define TANKS_MODEL_HPP
#include <filesystem>
#include <glm/glm.hpp>
#include <string>
#include <vector>
namespace trb::game {
struct vertex {
glm::vec3 position;
glm::vec3 normal;
glm::vec2 uv;
};
struct mesh_node {
std::vector<vertex> vertices;
std::vector<std::uint32_t> indices;
std::uint32_t material_index;
glm::mat4 transform;
std::string name;
};
struct texture_source {
std::unique_ptr<std::byte[]> pixels = {};
glm::uvec2 extent = {};
};
struct material_node {
std::uint32_t albedo_texture = {};
std::string name;
};
struct scene {
std::vector<mesh_node> meshes;
std::vector<material_node> materials;
std::vector<texture_source> textures;
std::string name;
};
[[nodiscard]] scene load_glb(std::filesystem::path path);
} // namespace trb::game
#endif