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

45 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include "component.h"
2022-09-22 02:52:06 +00:00
#include "../../gfx/mesh.h"
#include "../../gfx/material.h"
#include <iostream>
#include <vector>
namespace simpleengine {
/**
* @brief A Model is a object that will be shown on the screen by a renderer.
*
*/
2022-09-22 02:52:06 +00:00
class MeshComponent : public simpleengine::Component {
public:
2022-09-22 02:52:06 +00:00
gfx::Mesh model;
//gfx::Material material;
2022-09-22 02:52:06 +00:00
MeshComponent(gfx::Mesh model) : model(model) {
}
2022-09-22 02:52:06 +00:00
MeshComponent(std::vector<LitVertex> vertices, std::vector<GLuint> indicies, gfx::Material material,
bool calculate_normals = false): model(vertices, indicies, material) {
if (calculate_normals) {
model.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) :
model(vertices, indicies, material) {
if (calculate_normals) {
model.calculate_normals();
}
}
virtual void update(const float& delta_time) override {
2022-09-22 02:52:06 +00:00
}
};
}