"VRam List" wrapped for VBO (useful later)
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 6m25s

This commit is contained in:
2024-09-17 14:36:32 -04:00
parent 9d6d256e80
commit 41fa634da1
5 changed files with 112 additions and 23 deletions

View File

@@ -16,4 +16,21 @@ namespace JGL {
inline bool operator&(Direction a, Direction b) {
return (u8)a & (u8)b;
}
}
static std::string to_string(JGL::Direction direction) {
switch (direction) {
case JGL::Direction::None:
return "None";
case JGL::Direction::Vertical:
return "Vertical";
case JGL::Direction::Horizontal:
return "Horizontal";
case JGL::Direction::Diagonal_NWSE:
return "Diagonal_NWSE";
case JGL::Direction::Diagonal_SWNE:
return "Diagonal_SWNE";
default:
return "Unknown";
}
}
}

View File

@@ -0,0 +1,30 @@
#pragma once
#include <glad/glad.h>
#include <J3ML/LinearAlgebra/Vector2.hpp>
#include <J3ML/LinearAlgebra/Vector3.hpp>
#include <J3ML/LinearAlgebra/Vector4.hpp>
#include <vector>
#include <string>
namespace JGL {
class VRamList;
}
/// A wrapper for VBO, Storing texture coordinates or vertices or indices in vram.
/// For J2D, We can't really store the vertices into vram. But we can store the texture coordinates.
class JGL::VRamList {
private:
GLuint list_handle = 0;
void load(const GLfloat* data, const long& size);
void load(const GLuint* data, const long& size);
public:
VRamList() = default;
VRamList(const GLfloat* data, const long& size);
VRamList(Vector2* data, const long& size);
VRamList(Vector3* data, const long& size);
VRamList(Vector4* data, const long& size);
VRamList(const GLuint* data, const long& size);
public:
[[nodiscard]] GLuint GetHandle() const;
void Erase();
};