Cleanup
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m46s

This commit is contained in:
2024-07-19 01:34:43 -04:00
parent eca4309e85
commit 0b7af6fd31
2 changed files with 14 additions and 18 deletions

View File

@@ -1,10 +1,14 @@
#pragma once
#include <J3ML/J3ML.h>
namespace JGL {
enum class Inversion : u8 {
enum Inversion {
None = 0,
Vertical = 1,
Horizontal = 2,
Both = 3
};
inline Inversion operator|(Inversion a, Inversion b) {
return static_cast<Inversion>(static_cast<int>(a) | static_cast<int>(b));
}
}

View File

@@ -130,23 +130,15 @@ namespace JGL {
if (!inJ2D)
ERROR("Attempt to Render J2D element before J2D begin.")
std::array<Vector2, 4> textureCoordinates;
std::array<Vector2, 4> textureCoordinates = {Vector2(0, 0), Vector2(0, 1), Vector2(1, 1), Vector2(1, 0)};;
const Vector2 vertices[] = {{pos.x, pos.y}, {pos.x, pos.y + size.y}, {pos.x + size.x, pos.y + size.y}, {pos.x + size.x, pos.y}};
switch (inversion) {
case Inversion::None:
textureCoordinates = {Vector2(0, 0), Vector2(0, 1), Vector2(1, 1), Vector2(1, 0)};
break;
case Inversion::Vertical:
textureCoordinates = {Vector2(0, 1), Vector2(0, 0), Vector2(1, 0), Vector2(1, 1)};
break;
case Inversion::Horizontal:
textureCoordinates = {Vector2(1, 0), Vector2(1, 1), Vector2(0, 1), Vector2(0, 0)};
break;
case Inversion::Both:
textureCoordinates = {Vector2(1, 1), Vector2(1, 0), Vector2(0, 0), Vector2(0, 1)};
break;
}
if (inversion & Inversion::Vertical)
textureCoordinates = {Vector2(0, 1), Vector2(0, 0), Vector2(1, 0), Vector2(1, 1)};
if (inversion & Inversion::Horizontal)
textureCoordinates = {Vector2(1, 0), Vector2(1, 1), Vector2(0, 1), Vector2(0, 0)};
if ((inversion& Inversion::Horizontal) && (inversion& Inversion::Vertical))
textureCoordinates = {Vector2(1, 1), Vector2(1, 0), Vector2(0, 0), Vector2(0, 1)};
glColor4f(baseColor[0],baseColor[1],baseColor[2],opacity / 255.f);
glBindTexture(GL_TEXTURE_2D, texture);