patterns/stl: Added 3D model visualization

This commit is contained in:
Nik
2023-02-20 11:35:15 +01:00
committed by GitHub
parent 15234a284d
commit e635c3a5bf

View File

@@ -5,6 +5,7 @@
#include <std/sys.pat>
#include <std/mem.pat>
#include <std/core.pat>
struct Vector3f {
float x, y, z;
@@ -21,7 +22,7 @@ struct Triangle {
} [[static]];
struct BinarySTLHeader {
char caption[];
char caption[while($[$] != 0x00 && $ - addressof(this) < 80)];
padding[80 - sizeof(caption)];
u32 triangleCount;
};
@@ -36,3 +37,15 @@ struct STL {
};
STL stl @ 0x00;
/* Visualize the 3D Model */
struct Vertex {
Vector3f points[3] @ addressof(stl.triangles[std::core::array_index()].points);
};
struct Model {
Vertex vertices[stl.header.triangleCount];
} [[highlight_hidden, sealed, hex::visualize("3d", vertices, null)]];
Model model @ 0x00;