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

47 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#ifdef __linux__
#include <GL/glew.h>
#include <GL/gl.h>
#elif
#include <gl/glew.h>
#include <gl/gl.h>
#endif
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
2021-12-07 03:54:22 +00:00
#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"
#include "../../../transformable.h"
#include <vector>
2021-12-07 03:54:22 +00:00
namespace simpleengine::objects_2d::shapes {
class Triangle : public simpleengine::Renderable, public simpleengine::Transformable {
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(GLFWwindow* target) override;
};
}