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>
|
|
|
|
|
2021-12-07 03:54:22 +00:00
|
|
|
#include "../../../renderable.h"
|
|
|
|
#include "../../../vertex.h"
|
|
|
|
#include "../../../transformable.h"
|
|
|
|
#include "../../../optional.h"
|
2021-11-25 21:15:24 +00:00
|
|
|
|
2021-12-07 03:54:22 +00:00
|
|
|
#include "../../../gfx/vbo.h"
|
|
|
|
#include "../../../gfx/vao.h"
|
|
|
|
#include "../../../gfx/texture.h"
|
|
|
|
#include "../../../gfx/shader.h"
|
2021-11-25 21:15:24 +00:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <vector>
|
|
|
|
|
2021-12-07 03:54:22 +00:00
|
|
|
namespace simpleengine::objects_2d::shapes {
|
2021-12-03 04:10:32 +00:00
|
|
|
class Square : public simpleengine::Renderable, public simpleengine::Transformable {
|
2021-11-25 21:15:24 +00:00
|
|
|
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
|
|
|
}
|