SimpleEngine/include/simpleengine/shapes/2d/triangle.h

44 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include <gl/glew.h>
#include <gl/gl.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include "../../renderable.h"
#include "../../vertex.h"
#include "../../gfx/vbo.h"
#include "../../gfx/vao.h"
#include "../../gfx/shader.h"
#include "../../gfx/texture.h"
#include "../../optional.h"
2021-11-28 18:21:25 +00:00
#include "../../translatable.h"
#include <vector>
namespace simpleengine::shapes_2d {
class Triangle : public simpleengine::Renderable {
private:
using super = simpleengine::Renderable;
private:
gfx::Shader shader; // This only stores the shader program
nonstd::optional<gfx::Texture> texture;
public:
2021-11-26 03:28:47 +00:00
std::vector<Vertex> vertices;
gfx::VBO vbo;
gfx::VAO vao;
Triangle(gfx::Shader shader, std::vector<Vertex> vertices);
2021-11-26 03:28:47 +00:00
Triangle(std::shared_ptr<GLuint> shader_program, std::vector<Vertex> vertices);
2021-11-26 03:28:47 +00:00
virtual ~Triangle() = default;
2021-11-26 03:28:47 +00:00
void set_texture(gfx::Texture texture);
virtual void update(const float& delta_time) override;
virtual void render(std::shared_ptr<GLFWwindow> target) override;
};
}