mirror of
https://github.com/guezoloic/LearnOpenGL.git
synced 2026-01-25 07:34:16 +00:00
feat: add a few improvements of cube logic
This commit is contained in:
24
inc/cube.hpp
24
inc/cube.hpp
@@ -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
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user