From 343e66b816bdbca727442cc190a18f41d93428c6 Mon Sep 17 00:00:00 2001 From: Jesse Buhagiar Date: Sun, 23 May 2021 23:57:53 +1000 Subject: 3DFileViewer: Support textured models Models that contain UV co-ordinates are now supported, and will display with a texture wrapped around it, provided a `bmp` with the same name as the object is in the same directory as the 3D Model. --- Userland/Applications/3DFileViewer/Mesh.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Userland/Applications/3DFileViewer/Mesh.h') diff --git a/Userland/Applications/3DFileViewer/Mesh.h b/Userland/Applications/3DFileViewer/Mesh.h index 7f979cff0a..b17b0bde8e 100644 --- a/Userland/Applications/3DFileViewer/Mesh.h +++ b/Userland/Applications/3DFileViewer/Mesh.h @@ -16,7 +16,7 @@ class Mesh : public RefCounted { public: Mesh() = delete; - Mesh(Vector vertices, Vector triangles); + Mesh(Vector vertices, Vector tex_coords, Vector triangles); size_t vertex_count() const { return m_vertex_list.size(); } @@ -24,7 +24,10 @@ public: void draw(); + bool is_textured() const { return m_tex_coords.size() > 0; } + private: Vector m_vertex_list; + Vector m_tex_coords; Vector m_triangle_list; }; -- cgit v1.2.3