feat: add a few improvements of cube logic

This commit is contained in:
2025-12-30 14:27:11 +01:00
parent 03c8f77029
commit 7f70d00e4c
9 changed files with 77 additions and 185 deletions

View File

@@ -1,29 +1,15 @@
#ifndef CUBE_HPP
#define CUBE_HPP
#include <stddef.h>
#include "camera.hpp"
#include "ebo.hpp"
#include "shader.hpp"
#include "texture.hpp"
#include "vao.hpp"
#include "vbo.hpp"
#include "glm/ext/vector_float3.hpp"
#include "shape.hpp"
class Cube
class Cube : public Shape
{
private:
VBO vbo;
EBO ebo;
VAO vao;
Camera &camera;
Shader shader;
Texture texture;
public:
Cube(Camera &camera);
void loop(int width, int height);
Cube(Camera &camera, glm::vec3 pos, std::string texture);
void render(int width, int height) override;
};
#endif

View File

@@ -14,7 +14,7 @@ class EBO
EBO();
~EBO();
void setData(unsigned int* indices, size_t size);
void setData(const unsigned int* indices, size_t size);
void bind();
void unbind();

View File

@@ -25,7 +25,10 @@ class Shape
Texture texture;
public:
Shape(Camera &camera, glm::vec3 pos, Shader shader, Texture texture);
Shape(Camera &camera, glm::vec3 pos, Shader shader, Texture texture)
: camera(camera), pos(pos), shader(shader), texture(texture)
{
}
virtual void render(int width, int height) = 0;

View File

@@ -14,7 +14,7 @@ class VBO
VBO();
~VBO();
void setData(GLfloat* vertices, size_t size);
void setData(const GLfloat* vertices, size_t size);
void bind();
void unbind();