mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
3DFileViewer: Add 'normals' to Mesh constructor
This change allows a Mesh object to be created with a vector of normals.
This commit is contained in:
parent
7fb8af73bf
commit
5fd58a2663
3 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
||||||
* Copyright (c) 2021, Mathieu Gaillard <gaillard.mathieu.39@gmail.com>
|
* Copyright (c) 2021, Mathieu Gaillard <gaillard.mathieu.39@gmail.com>
|
||||||
|
* Copyright (c) 2021, Pedro Pereira <pmh.pereira@gmail.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -22,9 +23,10 @@ const Color colors[] {
|
||||||
Color::White
|
Color::White
|
||||||
};
|
};
|
||||||
|
|
||||||
Mesh::Mesh(Vector<Vertex> vertices, Vector<TexCoord> tex_coords, Vector<Triangle> triangles)
|
Mesh::Mesh(Vector<Vertex> vertices, Vector<TexCoord> tex_coords, Vector<Vertex> normals, Vector<Triangle> triangles)
|
||||||
: m_vertex_list(move(vertices))
|
: m_vertex_list(move(vertices))
|
||||||
, m_tex_coords(move(tex_coords))
|
, m_tex_coords(move(tex_coords))
|
||||||
|
, m_normal_list(move(normals))
|
||||||
, m_triangle_list(move(triangles))
|
, m_triangle_list(move(triangles))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
||||||
* Copyright (c) 2021, Mathieu Gaillard <gaillard.mathieu.39@gmail.com>
|
* Copyright (c) 2021, Mathieu Gaillard <gaillard.mathieu.39@gmail.com>
|
||||||
|
* Copyright (c) 2021, Pedro Pereira <pmh.pereira@gmail.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -16,7 +17,7 @@ class Mesh : public RefCounted<Mesh> {
|
||||||
public:
|
public:
|
||||||
Mesh() = delete;
|
Mesh() = delete;
|
||||||
|
|
||||||
Mesh(Vector<Vertex> vertices, Vector<TexCoord> tex_coords, Vector<Triangle> triangles);
|
Mesh(Vector<Vertex> vertices, Vector<TexCoord> tex_coords, Vector<Vertex> normals, Vector<Triangle> triangles);
|
||||||
|
|
||||||
size_t vertex_count() const { return m_vertex_list.size(); }
|
size_t vertex_count() const { return m_vertex_list.size(); }
|
||||||
|
|
||||||
|
@ -29,5 +30,6 @@ public:
|
||||||
private:
|
private:
|
||||||
Vector<Vertex> m_vertex_list;
|
Vector<Vertex> m_vertex_list;
|
||||||
Vector<TexCoord> m_tex_coords;
|
Vector<TexCoord> m_tex_coords;
|
||||||
|
Vector<Vertex> m_normal_list;
|
||||||
Vector<Triangle> m_triangle_list;
|
Vector<Triangle> m_triangle_list;
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,5 +127,5 @@ RefPtr<Mesh> WavefrontOBJLoader::load(Core::File& file)
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgln("Wavefront: Done.");
|
dbgln("Wavefront: Done.");
|
||||||
return adopt_ref(*new Mesh(vertices, tex_coords, triangles));
|
return adopt_ref(*new Mesh(vertices, tex_coords, normals, triangles));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue