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