skybox: added moon and stars

This commit is contained in:
MihailRis
2024-01-26 02:49:42 +03:00
parent b42a517cc6
commit a4a5aef422
22 changed files with 258 additions and 52 deletions
+16 -6
View File
@@ -134,9 +134,9 @@ void Batch3D::sprite(vec3 pos, vec3 up, vec3 right, float w, float h, const UVRe
uv.u2, uv.v2,
r,g,b,a);
vertex(pos.x - right.x * w - up.x * h,
pos.y + right.y * w + up.y * h,
pos.z - right.z * w - up.z * h,
vertex(pos.x - right.x * w + up.x * h,
pos.y - right.y * w + up.y * h,
pos.z - right.z * w + up.z * h,
uv.u1, uv.v2,
r,g,b,a);
@@ -146,9 +146,9 @@ void Batch3D::sprite(vec3 pos, vec3 up, vec3 right, float w, float h, const UVRe
uv.u1, uv.v1,
r,g,b,a);
vertex(pos.x + right.x * w + up.x * h,
pos.y - right.y * w - up.y * h,
pos.z + right.z * w + up.z * h,
vertex(pos.x + right.x * w - up.x * h,
pos.y + right.y * w - up.y * h,
pos.z + right.z * w - up.z * h,
uv.u2, uv.v1,
r,g,b,a);
@@ -178,8 +178,18 @@ void Batch3D::blockCube(const vec3 size, const UVRegion(&texfaces)[6], const vec
face(coord+vec3(size.x, 0.0f, 0.0f), size.z, size.y, vec3(0, 0, -1), vec3(0, 1, 0), texfaces[1], (shading ? do_tint(0.9f)*tint : tint));
}
void Batch3D::point(glm::vec3 coord, glm::vec4 tint) {
vertex(coord, glm::vec2(), tint.r, tint.g, tint.b, tint.a);
}
void Batch3D::flush() {
mesh->reload(buffer, index / B3D_VERTEX_SIZE);
mesh->draw();
index = 0;
}
void Batch3D::flushPoints() {
mesh->reload(buffer, index / B3D_VERTEX_SIZE);
mesh->draw(GL_POINTS);
index = 0;
}