VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
Mesh.hpp
Go to the documentation of this file.
1
6
7#pragma once
8#include "components/PathUtils.hpp"
9#include "components/AssetTypes.hpp"
10
11#include <filesystem>
12#include <glm/glm.hpp>
13#include <vector>
14#include <string>
15#define SDL_MAIN_HANDLED
16#include <SDL3/SDL.h>
17#include <iostream>
18
19struct aiScene;
20
21namespace vex {
23
25 struct Vertex {
26 glm::vec3 position;
27 glm::vec3 normal;
29 glm::vec2 uv = glm::vec2(-100000.0f);
30 };
31
33 struct Submesh {
34 std::vector<Vertex> vertices;
35 std::vector<uint32_t> indices;
36 texture_asset_path texturePath;
37 std::vector<glm::vec3> triangleCenters;
38 };
39
41 struct MeshData {
42 std::vector<Submesh> submeshes;
43 mesh_asset_path meshPath;
44
50 void loadFromFile(const std::string& path, VirtualFileSystem* vfs);
51
55 void loadFromRawFile(const std::string& relativePath);
56
57 void clear() {
58 submeshes.clear();
59 }
60
61 private:
66 void processScene(const aiScene* scene, const std::string& textureBaseDir);
67 };
68}
This class provides abstraction of file system needed for loading packed and unpacked assets.
Mesh data structure for loading and managing mesh data.
Definition Mesh.hpp:41
void loadFromFile(const std::string &path, VirtualFileSystem *vfs)
Loads mesh data from a file using the Virtual File System.
Definition Mesh.cpp:271
void processScene(const aiScene *scene, const std::string &textureBaseDir)
Internal helper to convert an Assimp aiScene into VEX Submesh structures.
Definition Mesh.cpp:183
void loadFromRawFile(const std::string &relativePath)
Loads a mesh directly from the physical disk, bypassing the VFS.
Definition Mesh.cpp:240
Submesh structure for mesh data, its made like this cause some file formats hold multiple meshes in o...
Definition Mesh.hpp:33
Vertex structure for mesh data.
Definition Mesh.hpp:25
glm::vec2 uv
UV coordinates for texture mapping but initialized to (-100000, -100000) for shader use....
Definition Mesh.hpp:29
Specific wrapper for Meshes.
Specific wrapper for Textures.