Path Tracing
Loading...
Searching...
No Matches
loader.hpp
Go to the documentation of this file.
1
8#pragma once
9#include "mesh.hpp"
10#include "bvh.hpp"
11#include <atomic>
12#include <vector>
13#include <thread>
14
16//\see ModelLoader::stage, loadScene
18 STAGE_PARSING = 0, //reading paths
19 STAGE_BVH, //building BVH
20 STAGE_UPLOAD_MESH, //uploading geometry/BVH/lights SSBOs
21 STAGE_UPLOAD_TEXTURES //decoding, uploading textures (might be the slowest right now)
22};
23
26inline const char* LOAD_STAGE_TEXT[] = {
27 "Loading Model...",
28 "Building BVH...",
29 "Uploading Geometry...",
30 "Loading Textures"
31};
32
34 std::vector<GPUTriangle> pending_tris;
35 std::vector<GPUMaterial> pending_mats;
36 std::vector<CPUMaterial> pending_cpu_mats;
37 std::vector<BVHNode> pending_bvh;
39 std::atomic<bool> upload_pending = false;
40 std::atomic<bool> is_loading = false;
41 std::atomic<int> stage = STAGE_PARSING;
42
44 std::thread worker;
45
48 std::vector<CPUMaterial> ui_cpu_mats;
49 std::vector<GPUMaterial> ui_mats;
50};
51
Bounding Volume Hierarchy construction and upload.
const char * LOAD_STAGE_TEXT[]
Display text per LoadStage.
Definition loader.hpp:26
LoadStage
Stages of the async model load in order.
Definition loader.hpp:17
@ STAGE_BVH
Definition loader.hpp:19
@ STAGE_UPLOAD_MESH
Definition loader.hpp:20
@ STAGE_PARSING
Definition loader.hpp:18
@ STAGE_UPLOAD_TEXTURES
Definition loader.hpp:21
ModelLoader loader
Definition loader.hpp:52
Loads 3D models through ASSIMP into CPU-side geometry and material data, defines the GPUVertex/GPUTri...
Loaded mesh bounding box, axis-aligned, used for AABB early rejection Calculated during loadMesh....
Definition mesh.hpp:96
Definition loader.hpp:33
std::thread worker
Handle of the current background load.
Definition loader.hpp:44
std::vector< CPUMaterial > pending_cpu_mats
Definition loader.hpp:36
MeshBounds pending_bounds
Definition loader.hpp:38
std::atomic< bool > upload_pending
Definition loader.hpp:39
std::vector< GPUMaterial > ui_mats
Definition loader.hpp:49
std::atomic< bool > is_loading
Definition loader.hpp:40
std::vector< CPUMaterial > ui_cpu_mats
Definition loader.hpp:48
std::vector< BVHNode > pending_bvh
Definition loader.hpp:37
std::vector< GPUMaterial > pending_mats
Definition loader.hpp:35
std::vector< GPUTriangle > pending_tris
Definition loader.hpp:34
std::atomic< int > stage
Definition loader.hpp:41