2022-08-30 23:39:24 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "component.h"
|
2022-09-22 02:52:06 +00:00
|
|
|
#include "../../gfx/mesh.h"
|
2022-08-30 23:39:24 +00:00
|
|
|
#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 {
|
2022-08-30 23:39:24 +00:00
|
|
|
public:
|
2022-09-22 02:52:06 +00:00
|
|
|
gfx::Mesh model;
|
2022-08-30 23:39:24 +00:00
|
|
|
//gfx::Material material;
|
|
|
|
|
2022-09-22 02:52:06 +00:00
|
|
|
MeshComponent(gfx::Mesh model) : model(model) {
|
2022-08-30 23:39:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-09-22 02:52:06 +00:00
|
|
|
MeshComponent(std::vector<LitVertex> vertices, std::vector<GLuint> indicies, gfx::Material material,
|
2022-09-16 21:01:52 +00:00
|
|
|
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>(),
|
2022-09-16 21:01:52 +00:00
|
|
|
std::optional<gfx::Material> material = std::nullopt, bool calculate_normals = false) :
|
|
|
|
model(vertices, indicies, material) {
|
|
|
|
|
|
|
|
if (calculate_normals) {
|
|
|
|
model.calculate_normals();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-30 23:39:24 +00:00
|
|
|
virtual void update(const float& delta_time) override {
|
2022-09-22 02:52:06 +00:00
|
|
|
|
2022-08-30 23:39:24 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|