fix particles normals

This commit is contained in:
MihailRis 2025-07-07 20:42:30 +03:00
parent 7a98f0c411
commit a585b52aa2
4 changed files with 33 additions and 30 deletions

View File

@ -95,37 +95,37 @@ void MainBatch::cube(
quad(
coord + Z * size.z * 0.5f,
X, Y, glm::vec2(size.x, size.y),
X, Y, Z, glm::vec2(size.x, size.y),
(shading ? do_tint(0.8) * tint : tint),
glm::vec3(1.0f), texfaces[5]
);
quad(
coord - Z * size.z * 0.5f,
-X, Y, glm::vec2(size.x, size.y),
-X, Y, -Z, glm::vec2(size.x, size.y),
(shading ? do_tint(0.9f) * tint : tint),
glm::vec3(1.0f), texfaces[4]
);
quad(
coord + Y * size.y * 0.5f,
-X, Z, glm::vec2(size.x, size.z),
-X, Z, Y, glm::vec2(size.x, size.z),
(shading ? do_tint(1.0f) * tint : tint),
glm::vec3(1.0f), texfaces[3]
);
quad(
coord - Y * size.y * 0.5f,
X, Z, glm::vec2(size.x, size.z),
X, Z, -Y, glm::vec2(size.x, size.z),
(shading ? do_tint(0.7f) * tint : tint),
glm::vec3(1.0f), texfaces[2]
);
quad(
coord + X * size.x * 0.5f,
-Z, Y, glm::vec2(size.z, size.y),
-Z, Y, X, glm::vec2(size.z, size.y),
(shading ? do_tint(0.8f) * tint : tint),
glm::vec3(1.0f), texfaces[1]
);
quad(
coord - X * size.x * 0.5f,
Z, Y, glm::vec2(size.z, size.y),
Z, Y, -X, glm::vec2(size.z, size.y),
(shading ? do_tint(0.9f) * tint : tint),
glm::vec3(1.0f), texfaces[1]
);

View File

@ -86,6 +86,7 @@ public:
const glm::vec3& pos,
const glm::vec3& right,
const glm::vec3& up,
const glm::vec3& normal,
const glm::vec2& size,
const glm::vec4& light,
const glm::vec3& tint,
@ -97,21 +98,21 @@ public:
{subregion.u1, subregion.v1},
light,
tint,
glm::cross(up, right)
normal
);
vertex(
pos + right * size.x * 0.5f - up * size.y * 0.5f,
{subregion.u2, subregion.v1},
light,
tint,
glm::cross(up, right)
normal
);
vertex(
pos + right * size.x * 0.5f + up * size.y * 0.5f,
{subregion.u2, subregion.v2},
light,
tint,
glm::cross(up, right)
normal
);
vertex(
@ -119,21 +120,21 @@ public:
{subregion.u1, subregion.v1},
light,
tint,
glm::cross(up, right)
normal
);
vertex(
pos + right * size.x * 0.5f + up * size.y * 0.5f,
{subregion.u2, subregion.v2},
light,
tint,
glm::cross(up, right)
normal
);
vertex(
pos - right * size.x * 0.5f + up * size.y * 0.5f,
{subregion.u1, subregion.v2},
light,
tint,
glm::cross(up, right)
normal
);
}

View File

@ -134,6 +134,7 @@ void ParticlesRenderer::renderParticles(const Camera& camera, float delta) {
particle.position,
localRight,
localUp,
-camera.front,
preset.size * scale,
light,
glm::vec3(1.0f),

View File

@ -146,6 +146,7 @@ void PrecipitationRenderer::render(
pos,
face.right,
{0, 1, 0},
glm::cross(glm::vec3(0, 1, 0), face.right),
FACE_SIZE,
light_at(chunks, pos.x, y, pos.z),
glm::vec3(1.0f),