Reformatting
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 6m56s

This commit is contained in:
2024-11-14 10:57:00 -05:00
parent 6dff2f97c1
commit e6dcc9d61e
3 changed files with 537 additions and 544 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -20,15 +20,15 @@ private:
bool spin_lock = false;
void load(const GLfloat* data, const long& size);
void load(const GLuint* data, const long& size);
void SetData(void* data, const long& length);
void UpdateData(void* data, const long& offset, const long& length);
void SetData(void* data, const long& count);
void UpdateData(void* data, const long& offset, const long& count);
void Erase();
public:
VRamList(const GLuint* data, const long& length);
VRamList(const GLfloat* data, const long& length);
VRamList(const Vector2* data, const long& length);
VRamList(const Vector3* data, const long& length);
VRamList(const Vector4* data, const long& length);
VRamList(const GLuint* data, const long& count);
VRamList(const GLfloat* data, const long& count);
VRamList(const Vector2* data, const long& count);
VRamList(const Vector3* data, const long& count);
VRamList(const Vector4* data, const long& count);
~VRamList();
/** Copying around the VBO data to a new VBO like this is slow.
@@ -46,25 +46,23 @@ public:
[[nodiscard]] std::vector<GLfloat> GetDataF() const;
[[nodiscard]] std::vector<GLuint> GetDataUI() const;
[[nodiscard]] bool IsFloatArray() const;
/** Replace the data of an existing VBO in it's entirety. Must be same type.
* "length" refers to the number of elements in data. Not the number of bytes. */
void SetData(const GLfloat* data, const long& length);
void SetData(const Vector2* data, const long& length);
void SetData(const Vector3* data, const long& length);
void SetData(const Vector4* data, const long& length);
/** Replace the data of an existing VBO in it's entirety. Must be same type. */
void SetData(const GLfloat* data, const long& count);
void SetData(const Vector2* data, const long& count);
void SetData(const Vector3* data, const long& count);
void SetData(const Vector4* data, const long& count);
void SetData(const GLuint* data, const long& length);
void SetData(const Vector2i* data, const long& length);
void SetData(const GLuint* data, const long& count);
void SetData(const Vector2i* data, const long& count);
/** Update only a portion of the data in a VBO. Must be same type.
* "length" refers to the number of elements in data. Not the number of bytes.
* "offset" refers the number of Typename T into the buffer the data you want to change is.
* For ex, offset 0 and length of 1 overwrites the first value. Offset 1 the second etc */
void UpdateData(const GLfloat* data, const long& offset, const long& length);
void UpdateData(const Vector2* data, const long& offset, const long& length);
void UpdateData(const Vector3* data, const long& offset, const long& length);
void UpdateData(const Vector4* data, const long& offset, const long& length);
void UpdateData(const GLfloat* data, const long& offset, const long& count);
void UpdateData(const Vector2* data, const long& offset, const long& count);
void UpdateData(const Vector3* data, const long& offset, const long& count);
void UpdateData(const Vector4* data, const long& offset, const long& count);
void UpdateData(const GLuint* data, const long& offset, const long& length);
void UpdateData(const Vector2i* data, const long& offset, const long& length);
void UpdateData(const GLuint* data, const long& offset, const long& count);
void UpdateData(const Vector2i* data, const long& offset, const long& count);
};

View File

@@ -390,6 +390,7 @@ namespace JGL {
if (rt.TextureCreatedByRenderTarget())
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
void J2D::DrawSprite(const Texture& texture, const Vector2& pos, float rad_rotation, const Vector2& origin,
const Vector2& scale, const Color4& color, Direction inversion) {
if (!inJ2D)
@@ -462,7 +463,7 @@ namespace JGL {
color, inversion);
}
void J2D::DrawPartialSprite(const Texture& texture, const Vector2 &position, const Vector2& sub_texture_position,
void J2D::DrawPartialSprite(const Texture& texture, const Vector2& position, const Vector2& sub_texture_position,
const Vector2& sub_texture_size, float rad_rotation, const Vector2& origin,
const Vector2& scale, const Color4& color, Direction inversion) {
if (!inJ2D)
@@ -731,7 +732,7 @@ namespace JGL {
}
//TODO render all in once pass with GL_LINE_LOOP instead of separate lines.
void J2D::DrawCubicBezierCurve(const Color4 &color, const Vector2& controlA, const Vector2& pointA, const Vector2& pointB, const Vector2& controlB,
void J2D::DrawCubicBezierCurve(const Color4& color, const Vector2& controlA, const Vector2& pointA, const Vector2& pointB, const Vector2& controlB,
int subdivisions, float thickness) {
@@ -763,7 +764,7 @@ namespace JGL {
glColor4fv(baseColor);
}
void J2D::DrawGradientLine(const Color4 &color_a, const Color4 &color_b, float x, float y, float w, float h,
void J2D::DrawGradientLine(const Color4& color_a, const Color4& color_b, float x, float y, float w, float h,
float thickness) {
DrawGradientLine(color_a, color_b, {x, y}, {w, h}, thickness);
}
@@ -801,7 +802,7 @@ namespace JGL {
glColor4fv(baseColor);
}
void J2D::OutlineRoundedRect(const Color4 &color, const Vector2 &pos, const Vector2 &size, float radius, float thickness)
void J2D::OutlineRoundedRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius, float thickness)
{
// A rounded rectangle of size 2a x 2b with rounding radius r is given by
// f(x; a, r) + f(y; b, r) = 1
@@ -865,7 +866,7 @@ namespace JGL {
}
void J2D::FillChamferRect(const Color4 &color, const Vector2 &pos, const Vector2 &size, float radius) {
void J2D::FillChamferRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius) {
FillRoundedRect(color, pos, size, radius, 4);
}
@@ -900,14 +901,12 @@ namespace JGL {
FillTriangle(color, {triA, triB, triC});
}
void
J2D::FillGradientTriangle(const Color4 &a_color, const Color4 &b_color, const Color4 &c_color, const Vector2 &tri_a,
const Vector2 &tri_b, const Vector2 &tri_c) {
void J2D::FillGradientTriangle(const Color4& a_color, const Color4& b_color, const Color4& c_color, const Vector2& tri_a,
const Vector2& tri_b, const Vector2& tri_c) {
FillGradientTriangle(a_color, b_color, c_color, {tri_a, tri_b, tri_c});
}
void
J2D::OutlineEllipse(const Color4 &color, const Vector2 &position, float radius_x, float radius_y, float thickness,
void J2D::OutlineEllipse(const Color4& color, const Vector2& position, float radius_x, float radius_y, float thickness,
int subdivisions) {
if (!inJ2D)
Logger::Error("Drawing J2D element before J2D begin.");
@@ -934,8 +933,7 @@ namespace JGL {
glColor4fv(baseColor);
}
void
J2D::FillEllipse(const Color4 &color, const Vector2 &position, float radius_x, float radius_y, int subdivisions) {
void J2D::FillEllipse(const Color4& color, const Vector2& position, float radius_x, float radius_y, int subdivisions) {
if (!inJ2D)
Logger::Error("Drawing J2D element before J2D begin.");
@@ -1072,11 +1070,11 @@ namespace JGL {
void J3D::WireframeSphere(const Color4& color, const Vector3& position, float radius, float thickness, uint sectors, uint stacks) {
Sphere sphere = {position, radius};
BatchWireframeSphere(color, &sphere, 1, thickness, sectors, stacks);
BatchWireframeSphere(color,& sphere, 1, thickness, sectors, stacks);
}
void J3D::WireframeSphere(const Color4& color, const Sphere& sphere, float thickness, uint sectors, uint stacks) {
BatchWireframeSphere(color, &sphere, 1, thickness, sectors, stacks);
BatchWireframeSphere(color,& sphere, 1, thickness, sectors, stacks);
}
void J3D::BatchWireframeSphere(const Color4& color, const Sphere* spheres, const size_t& sphere_count, float thickness, uint sectors, uint stacks) {
@@ -1123,11 +1121,11 @@ namespace JGL {
void J3D::WireframeRevoSphere(const Color4& color, const Vector3& position, float radius, float thickness, uint sectors, uint revolutions, bool draw_stacks) {
Sphere sphere = {position, radius};
BatchWireframeRevoSphere(color, &sphere, 1, thickness, sectors, revolutions, draw_stacks);
BatchWireframeRevoSphere(color,& sphere, 1, thickness, sectors, revolutions, draw_stacks);
}
void J3D::WireframeRevoSphere(const Color4& color, const Sphere& sphere, float thickness, uint sectors, uint revolutions, bool draw_stacks) {
BatchWireframeRevoSphere(color, &sphere, 1, thickness, sectors, revolutions, draw_stacks);
BatchWireframeRevoSphere(color,& sphere, 1, thickness, sectors, revolutions, draw_stacks);
}
void J3D::BatchWireframeRevoSphere(const Color4& color, const Sphere* spheres, const size_t& sphere_count, float thickness, uint sectors, uint revolutions, bool draw_stacks) {
@@ -1250,7 +1248,7 @@ namespace JGL {
}
}
void J3D::WireframeIcosahedron(const Color4 &color, const Vector3 &position, float radius, float thickness) {
void J3D::WireframeIcosahedron(const Color4& color, const Vector3& position, float radius, float thickness) {
if (!inJ3D)
Logger::Error("Drawing J3D element before J3D begin.");
@@ -1296,7 +1294,7 @@ namespace JGL {
glColor4fv(baseColor);
}
void J3D::BatchWireframeAABB(const Color4& color, const AABB* boxes, const size_t &box_count, float thickness) {
void J3D::BatchWireframeAABB(const Color4& color, const AABB* boxes, const size_t& box_count, float thickness) {
std::array<Vector3, 24> vertices {
Vector3(-1, 1, -1), Vector3(1, 1, -1),
@@ -1333,7 +1331,7 @@ namespace JGL {
BatchWireframeAABB(color, &aabb, 1, thickness);
}
void J3D::FillAABB(const Color4 &color, const Vector3 &pos, const Vector3 &radii) {
void J3D::FillAABB(const Color4& color, const Vector3& pos, const Vector3& radii) {
if (!inJ3D)
Logger::Error("Drawing J3D element before J3D begin.");
@@ -1391,11 +1389,11 @@ namespace JGL {
glColor4fv(baseColor);
}
void J3D::FillAABB(const Color4 &color, const AABB &aabb) {
void J3D::FillAABB(const Color4& color, const AABB& aabb) {
FillAABB(color, aabb.Centroid(), aabb.Size());
}
void J3D::FillSphere(const Color4 &color, const Vector3& position, float radius, uint sectors, uint stacks) {
void J3D::FillSphere(const Color4& color, const Vector3& position, float radius, uint sectors, uint stacks) {
if (!inJ3D)
Logger::Error("Drawing J3D element before J3D begin.");
@@ -1455,7 +1453,7 @@ namespace JGL {
return value;
}
void J3D::WireframeOBB(const Color4& color, const J3ML::Geometry::OBB& obb, float thickness) {
void J3D::WireframeOBB(const Color4& color, const OBB& obb, float thickness) {
std::array<Vector3, 8> corner_points;
obb.GetCornerPoints(corner_points.data());
@@ -1477,8 +1475,8 @@ namespace JGL {
glPopMatrix();
}
void J3D::WireframeOBB(const Color4& color, const J3ML::LinearAlgebra::Vector3& position, const J3ML::LinearAlgebra::Vector3& radii,
const J3ML::LinearAlgebra::EulerAngle& orientation, float thickness) {
void J3D::WireframeOBB(const Color4& color, const Vector3& position, const Vector3& radii,
const EulerAngle& orientation, float thickness) {
Matrix3x3 rotation = orientation.ToQuaternion().ToMatrix3x3();
WireframeOBB(color, OBB(position, radii, rotation * Vector3::UnitX, rotation * Vector3::UnitY, rotation * Vector3::UnitZ), thickness);
}