diff --git a/Userland/Applications/3DFileViewer/Mesh.cpp b/Userland/Applications/3DFileViewer/Mesh.cpp index 0bae181b07..335962bb64 100644 --- a/Userland/Applications/3DFileViewer/Mesh.cpp +++ b/Userland/Applications/3DFileViewer/Mesh.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2021, Jesse Buhagiar * Copyright (c) 2021, Mathieu Gaillard + * Copyright (c) 2021, Pedro Pereira * * SPDX-License-Identifier: BSD-2-Clause */ @@ -22,9 +23,10 @@ const Color colors[] { Color::White }; -Mesh::Mesh(Vector vertices, Vector tex_coords, Vector triangles) +Mesh::Mesh(Vector vertices, Vector tex_coords, Vector normals, Vector triangles) : m_vertex_list(move(vertices)) , m_tex_coords(move(tex_coords)) + , m_normal_list(move(normals)) , m_triangle_list(move(triangles)) { } diff --git a/Userland/Applications/3DFileViewer/Mesh.h b/Userland/Applications/3DFileViewer/Mesh.h index ce5c718e7b..abd280f4b4 100644 --- a/Userland/Applications/3DFileViewer/Mesh.h +++ b/Userland/Applications/3DFileViewer/Mesh.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2021, Jesse Buhagiar * Copyright (c) 2021, Mathieu Gaillard + * Copyright (c) 2021, Pedro Pereira * * SPDX-License-Identifier: BSD-2-Clause */ @@ -16,7 +17,7 @@ class Mesh : public RefCounted { public: Mesh() = delete; - Mesh(Vector vertices, Vector tex_coords, Vector triangles); + Mesh(Vector vertices, Vector tex_coords, Vector normals, Vector triangles); size_t vertex_count() const { return m_vertex_list.size(); } @@ -29,5 +30,6 @@ public: private: Vector m_vertex_list; Vector m_tex_coords; + Vector m_normal_list; Vector m_triangle_list; }; diff --git a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp index bb881c333a..4ef2a87c13 100644 --- a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp +++ b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp @@ -127,5 +127,5 @@ RefPtr WavefrontOBJLoader::load(Core::File& file) } dbgln("Wavefront: Done."); - return adopt_ref(*new Mesh(vertices, tex_coords, triangles)); + return adopt_ref(*new Mesh(vertices, tex_coords, normals, triangles)); }