2021-11-27 19:16:41 +00:00
|
|
|
#pragma once
|
2021-11-21 06:23:53 +00:00
|
|
|
|
2021-12-02 21:58:15 +00:00
|
|
|
#ifdef __linux__
|
|
|
|
#include <GL/glew.h>
|
|
|
|
#include <GL/gl.h>
|
|
|
|
#elif
|
2021-11-21 06:23:53 +00:00
|
|
|
#include <gl/glew.h>
|
|
|
|
#include <gl/gl.h>
|
2021-12-02 21:58:15 +00:00
|
|
|
#endif
|
2021-11-21 06:23:53 +00:00
|
|
|
|
|
|
|
#include <GLFW/glfw3.h>
|
|
|
|
|
2021-11-25 21:15:24 +00:00
|
|
|
#include <glm/glm.hpp>
|
|
|
|
|
2021-11-21 06:23:53 +00:00
|
|
|
#include "../../renderable.h"
|
2021-11-25 21:15:24 +00:00
|
|
|
#include "../../vertex.h"
|
|
|
|
#include "../../gfx/vbo.h"
|
|
|
|
#include "../../gfx/vao.h"
|
2021-11-27 18:52:48 +00:00
|
|
|
#include "../../gfx/shader.h"
|
|
|
|
#include "../../gfx/texture.h"
|
|
|
|
#include "../../optional.h"
|
2021-12-03 04:07:06 +00:00
|
|
|
#include "../../transformable.h"
|
2021-11-25 21:15:24 +00:00
|
|
|
|
|
|
|
#include <vector>
|
2021-11-21 06:23:53 +00:00
|
|
|
|
|
|
|
namespace simpleengine::shapes_2d {
|
2021-12-03 04:07:06 +00:00
|
|
|
class Triangle : public simpleengine::Renderable, public simpleengine::Transformable {
|
2021-11-21 06:23:53 +00:00
|
|
|
private:
|
2021-11-27 18:52:48 +00:00
|
|
|
gfx::Shader shader; // This only stores the shader program
|
2021-11-27 19:11:07 +00:00
|
|
|
nonstd::optional<gfx::Texture> texture;
|
2021-11-21 06:23:53 +00:00
|
|
|
public:
|
2021-11-26 03:28:47 +00:00
|
|
|
std::vector<Vertex> vertices;
|
2021-11-25 21:15:24 +00:00
|
|
|
gfx::VBO vbo;
|
|
|
|
gfx::VAO vao;
|
2021-11-21 06:23:53 +00:00
|
|
|
|
2021-11-27 19:06:51 +00:00
|
|
|
Triangle(gfx::Shader shader, std::vector<Vertex> vertices);
|
2021-11-26 03:28:47 +00:00
|
|
|
|
2021-11-27 19:06:51 +00:00
|
|
|
Triangle(std::shared_ptr<GLuint> shader_program, std::vector<Vertex> vertices);
|
2021-11-26 03:28:47 +00:00
|
|
|
|
2021-11-27 18:52:48 +00:00
|
|
|
virtual ~Triangle() = default;
|
2021-11-26 03:28:47 +00:00
|
|
|
|
2021-11-27 19:11:07 +00:00
|
|
|
void set_texture(gfx::Texture texture);
|
2021-11-21 06:23:53 +00:00
|
|
|
|
2021-11-27 19:06:51 +00:00
|
|
|
virtual void update(const float& delta_time) override;
|
2021-12-02 21:58:15 +00:00
|
|
|
virtual void render(GLFWwindow* target) override;
|
2021-11-21 06:23:53 +00:00
|
|
|
};
|
2021-11-27 19:16:41 +00:00
|
|
|
}
|