Files
luagl/src/headers/Shape.hpp

42 lines
779 B
C++

#pragma once
#include <vector>
#include <memory>
#include <glm/glm.hpp>
#include "Shader.hpp"
struct ShapeInfo {
std::vector<float> vertices;
std::vector<unsigned int> indices;
};
class Shape {
public:
glm::mat4 transform;
Shape(
std::shared_ptr<Shader> shader,
ShapeInfo& shapeInfo
);
~Shape();
void init();
void draw() const;
void reset_transform();
void translate(const glm::vec3& translation);
void rotate(const float rotation_rad, const glm::vec3& axis);
void scale(const glm::vec3& scale_amount);
private:
std::vector<float> vertices;
std::vector<unsigned int> indices;
unsigned int vao;
unsigned int vbo;
unsigned int ebo;
std::shared_ptr<Shader> shader;
};