Change fro, RL_QUADS to RL_TRIANGLES

for web support
This commit is contained in:
Nikola Petrov
2024-03-31 00:35:33 +01:00
parent 09d1b0f5b0
commit e62b0eb6bf
3 changed files with 20 additions and 13 deletions

View File

@@ -25,7 +25,7 @@ void BackGround::newGen()
void BackGround::starts()
{
rlSetTexture(texShapes.id);
rlBegin(RL_QUADS);
rlBegin(RL_TRIANGLES);
rlNormal3f(0.0f, 0.0f, 1.0f);
for (size_t i = 1; i <= numOfStarts; i++)
@@ -40,18 +40,18 @@ void BackGround::starts()
rlColor4ub(color.r, color.g, color.b, color.a);
// topLeft
rlTexCoord2f(0, 0);
rlVertex2f(x, y);
// bottomLeft
rlTexCoord2f(0, 1);
rlVertex2f(x, y + weight);
// topRight
rlVertex2f(x + weight, y);
// bottomRight
rlTexCoord2f(1, 1);
rlVertex2f(x + weight, y + weight);
// topRight
rlTexCoord2f(1, 0);
rlVertex2f(x + weight, y);
// bottomLeft
rlVertex2f(x, y + weight);
}
rlEnd();
rlSetTexture(0);
@@ -83,17 +83,15 @@ void BackGround::mounten(size_t mountenSegments, float scale, int min, int max,
int y = Lerp(min, max, p);
rlSetTexture(texShapes.id);
rlBegin(RL_QUADS);
rlBegin(RL_TRIANGLES);
rlNormal3f(0.0f, 0.0f, 1.0f);
rlColor4ub(color.r, color.g, color.b, color.a);
for (size_t i = 1; i <= mountenSegments; i++)
{
// topLeft
rlTexCoord2f(0, 0);
rlVertex2f(x, y);
// bottomLeft
rlTexCoord2f(0, 1);
rlVertex2f(x, size);
nx = (float)(i + offsetX) * scale;
@@ -101,13 +99,15 @@ void BackGround::mounten(size_t mountenSegments, float scale, int min, int max,
p = (p + 1.0f) / 2.0f;
y = Lerp(min, max, p);
x += diff;
// topRight
rlVertex2f(x, y);
// bottomRight
rlTexCoord2f(1, 1);
rlVertex2f(x, size);
// topRight
rlTexCoord2f(1, 0);
rlVertex2f(x, y);
rlVertex2f(x - diff, size);
}
rlEnd();
rlSetTexture(0);