fix particles normals
This commit is contained in:
parent
7a98f0c411
commit
a585b52aa2
@ -94,39 +94,39 @@ void MainBatch::cube(
|
|||||||
const glm::vec3 Z(0.0f, 0.0f, 1.0f);
|
const glm::vec3 Z(0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
quad(
|
quad(
|
||||||
coord + Z * size.z * 0.5f,
|
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),
|
(shading ? do_tint(0.8) * tint : tint),
|
||||||
glm::vec3(1.0f), texfaces[5]
|
glm::vec3(1.0f), texfaces[5]
|
||||||
);
|
);
|
||||||
quad(
|
quad(
|
||||||
coord - Z * size.z * 0.5f,
|
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),
|
(shading ? do_tint(0.9f) * tint : tint),
|
||||||
glm::vec3(1.0f), texfaces[4]
|
glm::vec3(1.0f), texfaces[4]
|
||||||
);
|
);
|
||||||
quad(
|
quad(
|
||||||
coord + Y * size.y * 0.5f,
|
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),
|
(shading ? do_tint(1.0f) * tint : tint),
|
||||||
glm::vec3(1.0f), texfaces[3]
|
glm::vec3(1.0f), texfaces[3]
|
||||||
);
|
);
|
||||||
quad(
|
quad(
|
||||||
coord - Y * size.y * 0.5f,
|
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),
|
(shading ? do_tint(0.7f) * tint : tint),
|
||||||
glm::vec3(1.0f), texfaces[2]
|
glm::vec3(1.0f), texfaces[2]
|
||||||
);
|
);
|
||||||
quad(
|
quad(
|
||||||
coord + X * size.x * 0.5f,
|
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),
|
(shading ? do_tint(0.8f) * tint : tint),
|
||||||
glm::vec3(1.0f), texfaces[1]
|
glm::vec3(1.0f), texfaces[1]
|
||||||
);
|
);
|
||||||
quad(
|
quad(
|
||||||
coord - X * size.x * 0.5f,
|
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),
|
(shading ? do_tint(0.9f) * tint : tint),
|
||||||
glm::vec3(1.0f), texfaces[1]
|
glm::vec3(1.0f), texfaces[1]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,6 +86,7 @@ public:
|
|||||||
const glm::vec3& pos,
|
const glm::vec3& pos,
|
||||||
const glm::vec3& right,
|
const glm::vec3& right,
|
||||||
const glm::vec3& up,
|
const glm::vec3& up,
|
||||||
|
const glm::vec3& normal,
|
||||||
const glm::vec2& size,
|
const glm::vec2& size,
|
||||||
const glm::vec4& light,
|
const glm::vec4& light,
|
||||||
const glm::vec3& tint,
|
const glm::vec3& tint,
|
||||||
@ -97,21 +98,21 @@ public:
|
|||||||
{subregion.u1, subregion.v1},
|
{subregion.u1, subregion.v1},
|
||||||
light,
|
light,
|
||||||
tint,
|
tint,
|
||||||
glm::cross(up, right)
|
normal
|
||||||
);
|
);
|
||||||
vertex(
|
vertex(
|
||||||
pos + right * size.x * 0.5f - up * size.y * 0.5f,
|
pos + right * size.x * 0.5f - up * size.y * 0.5f,
|
||||||
{subregion.u2, subregion.v1},
|
{subregion.u2, subregion.v1},
|
||||||
light,
|
light,
|
||||||
tint,
|
tint,
|
||||||
glm::cross(up, right)
|
normal
|
||||||
);
|
);
|
||||||
vertex(
|
vertex(
|
||||||
pos + right * size.x * 0.5f + up * size.y * 0.5f,
|
pos + right * size.x * 0.5f + up * size.y * 0.5f,
|
||||||
{subregion.u2, subregion.v2},
|
{subregion.u2, subregion.v2},
|
||||||
light,
|
light,
|
||||||
tint,
|
tint,
|
||||||
glm::cross(up, right)
|
normal
|
||||||
);
|
);
|
||||||
|
|
||||||
vertex(
|
vertex(
|
||||||
@ -119,21 +120,21 @@ public:
|
|||||||
{subregion.u1, subregion.v1},
|
{subregion.u1, subregion.v1},
|
||||||
light,
|
light,
|
||||||
tint,
|
tint,
|
||||||
glm::cross(up, right)
|
normal
|
||||||
);
|
);
|
||||||
vertex(
|
vertex(
|
||||||
pos + right * size.x * 0.5f + up * size.y * 0.5f,
|
pos + right * size.x * 0.5f + up * size.y * 0.5f,
|
||||||
{subregion.u2, subregion.v2},
|
{subregion.u2, subregion.v2},
|
||||||
light,
|
light,
|
||||||
tint,
|
tint,
|
||||||
glm::cross(up, right)
|
normal
|
||||||
);
|
);
|
||||||
vertex(
|
vertex(
|
||||||
pos - right * size.x * 0.5f + up * size.y * 0.5f,
|
pos - right * size.x * 0.5f + up * size.y * 0.5f,
|
||||||
{subregion.u1, subregion.v2},
|
{subregion.u1, subregion.v2},
|
||||||
light,
|
light,
|
||||||
tint,
|
tint,
|
||||||
glm::cross(up, right)
|
normal
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -134,6 +134,7 @@ void ParticlesRenderer::renderParticles(const Camera& camera, float delta) {
|
|||||||
particle.position,
|
particle.position,
|
||||||
localRight,
|
localRight,
|
||||||
localUp,
|
localUp,
|
||||||
|
-camera.front,
|
||||||
preset.size * scale,
|
preset.size * scale,
|
||||||
light,
|
light,
|
||||||
glm::vec3(1.0f),
|
glm::vec3(1.0f),
|
||||||
|
|||||||
@ -146,6 +146,7 @@ void PrecipitationRenderer::render(
|
|||||||
pos,
|
pos,
|
||||||
face.right,
|
face.right,
|
||||||
{0, 1, 0},
|
{0, 1, 0},
|
||||||
|
glm::cross(glm::vec3(0, 1, 0), face.right),
|
||||||
FACE_SIZE,
|
FACE_SIZE,
|
||||||
light_at(chunks, pos.x, y, pos.z),
|
light_at(chunks, pos.x, y, pos.z),
|
||||||
glm::vec3(1.0f),
|
glm::vec3(1.0f),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user