SimpleEngine/include/simpleengine/ecs/component/mesh_component.h

39 lines
1.0 KiB
C
Raw Normal View History

#pragma once
2022-09-22 02:52:06 +00:00
#include "../../gfx/mesh.h"
#include "../../gfx/material.h"
#include <iostream>
#include <vector>
namespace simpleengine {
/**
* @brief A component that contains a Mesh that will be rendered.
*
*/
class MeshComponent {
public:
gfx::Mesh mesh;
MeshComponent(gfx::Mesh mesh) : mesh(mesh) {
}
2022-09-22 02:52:06 +00:00
MeshComponent(std::vector<LitVertex> vertices, std::vector<GLuint> indicies, gfx::Material material,
bool calculate_normals = false): mesh(vertices, indicies, material) {
if (calculate_normals) {
mesh.calculate_normals();
}
}
2022-09-22 02:52:06 +00:00
MeshComponent(std::vector<LitVertex> vertices, std::vector<GLuint> indicies = std::vector<GLuint>(),
std::optional<gfx::Material> material = std::nullopt, bool calculate_normals = false) :
mesh(vertices, indicies, material) {
if (calculate_normals) {
mesh.calculate_normals();
}
}
};
}