Loading...
Searching...
No Matches
VoxelLoader.hpp
1#pragma once
2#include <Threedim/TinyObj.hpp>
3#include <Threedim/Vox.hpp>
4#include <halp/controls.hpp>
5#include <halp/file_port.hpp>
6#include <halp/geometry.hpp>
7#include <halp/meta.hpp>
8
9namespace Threedim
10{
11
13{
14public:
15 halp_meta(name, "Voxel loader")
16 halp_meta(category, "Visuals/Meshes")
17 halp_meta(c_name, "voxel_loader")
18 halp_meta(authors, "Jean-Michaƫl Celerier, opengametools authors")
19 halp_meta(manual_url, "")
20 halp_meta(uuid, "a7c3e1b4-9f2d-4e8a-b6c5-1d3f7e9a2b4c")
21
22 enum VoxelMode
23 {
24 PointCloud,
25 Mesh_Simple,
26 Mesh_Greedy
27 };
28 struct ins
29 {
30 struct vox_t : halp::file_port<"Voxel file">
31 {
32 halp_meta(extensions, "Voxel files (*.vox)");
33 static std::function<void(VoxelLoader&)> process(file_type data);
34 } file;
35
36 struct : halp::combobox_t<"Mode", VoxelMode>
37 {
38 struct range
39 {
40 std::string_view values[3]{"Point Cloud", "Mesh (Simple)", "Mesh (Greedy)"};
41 int init{1};
42 };
43
44 void update(VoxelLoader& self) { self.reload(); }
45 } mode;
46
47 PositionControl position;
48 RotationControl rotation;
49 ScaleControl scale;
50 } inputs;
51
52 struct
53 {
54 struct : halp::mesh
55 {
56 halp_meta(name, "Geometry");
57 std::vector<halp::dynamic_geometry> mesh;
58 } geometry;
59 } outputs;
60
61 void reload();
62 void rebuild_geometry();
63
64 std::vector<mesh> meshinfo{};
65 float_vec complete;
66 float_vec palette;
67
68 // Cache the file data so mode changes can re-process
69 std::string cached_filename;
70};
71
72}
Definition VoxelLoader.hpp:13
Definition VoxelLoader.hpp:31
Definition VoxelLoader.hpp:29
Definition MIDISync.hpp:126