2021-05-02 17:19:50 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
|
2021-05-08 22:29:20 +03:00
|
|
|
* Copyright (c) 2021, Mathieu Gaillard <gaillard.mathieu.39@gmail.com>
|
2021-11-05 04:30:46 +03:00
|
|
|
* Copyright (c) 2021, Pedro Pereira <pmh.pereira@gmail.com>
|
2021-05-02 17:19:50 +03:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/RefCounted.h>
|
|
|
|
#include <AK/Vector.h>
|
|
|
|
|
|
|
|
#include "Common.h"
|
|
|
|
|
|
|
|
class Mesh : public RefCounted<Mesh> {
|
|
|
|
public:
|
|
|
|
Mesh() = delete;
|
|
|
|
|
2021-11-05 04:30:46 +03:00
|
|
|
Mesh(Vector<Vertex> vertices, Vector<TexCoord> tex_coords, Vector<Vertex> normals, Vector<Triangle> triangles);
|
2021-05-08 22:29:20 +03:00
|
|
|
|
|
|
|
size_t vertex_count() const { return m_vertex_list.size(); }
|
2021-05-02 17:19:50 +03:00
|
|
|
|
|
|
|
size_t triangle_count() const { return m_triangle_list.size(); }
|
|
|
|
|
2021-08-12 00:43:28 +03:00
|
|
|
void draw(float uv_scale);
|
2021-05-08 22:29:20 +03:00
|
|
|
|
2021-05-23 16:57:53 +03:00
|
|
|
bool is_textured() const { return m_tex_coords.size() > 0; }
|
|
|
|
|
2021-05-02 17:19:50 +03:00
|
|
|
private:
|
2021-05-08 22:29:20 +03:00
|
|
|
Vector<Vertex> m_vertex_list;
|
2021-05-23 16:57:53 +03:00
|
|
|
Vector<TexCoord> m_tex_coords;
|
2021-11-05 04:30:46 +03:00
|
|
|
Vector<Vertex> m_normal_list;
|
2021-05-02 17:19:50 +03:00
|
|
|
Vector<Triangle> m_triangle_list;
|
|
|
|
};
|