fix grass lighting
This commit is contained in:
parent
7a67beb801
commit
9d7816a286
@ -184,12 +184,18 @@ void BlocksRenderer::blockXSprite(
|
|||||||
const UVRegion& texface2,
|
const UVRegion& texface2,
|
||||||
float spread
|
float spread
|
||||||
) {
|
) {
|
||||||
glm::vec4 lights[] {
|
glm::vec4 lights1[] {
|
||||||
pickSoftLight({x, y + 1, z}, {1, 0, 0}, {0, 1, 0}),
|
pickSoftLight({x, y + 1, z}, {1, 0, 0}, {0, 1, 0}),
|
||||||
pickSoftLight({x + 1, y + 1, z}, {1, 0, 0}, {0, 1, 0}),
|
pickSoftLight({x + 1, y + 1, z}, {1, 0, 0}, {0, 1, 0}),
|
||||||
pickSoftLight({x + 1, y + 1, z}, {1, 0, 0}, {0, 1, 0}),
|
pickSoftLight({x + 1, y + 1, z}, {1, 0, 0}, {0, 1, 0}),
|
||||||
pickSoftLight({x, y + 1, z}, {1, 0, 0}, {0, 1, 0})
|
pickSoftLight({x, y + 1, z}, {1, 0, 0}, {0, 1, 0})
|
||||||
};
|
};
|
||||||
|
glm::vec4 lights2[] {
|
||||||
|
pickSoftLight({x, y + 1, z}, {-1, 0, 0}, {0, 1, 0}),
|
||||||
|
pickSoftLight({x - 1, y + 1, z}, {-1, 0, 0}, {0, 1, 0}),
|
||||||
|
pickSoftLight({x - 1, y + 1, z}, {-1, 0, 0}, {0, 1, 0}),
|
||||||
|
pickSoftLight({x, y + 1, z}, {-1, 0, 0}, {0, 1, 0})
|
||||||
|
};
|
||||||
randomizer.setSeed((x * 52321) ^ (z * 389) ^ y);
|
randomizer.setSeed((x * 52321) ^ (z * 389) ^ y);
|
||||||
short rand = randomizer.rand32();
|
short rand = randomizer.rand32();
|
||||||
|
|
||||||
@ -199,15 +205,15 @@ void BlocksRenderer::blockXSprite(
|
|||||||
const float w = size.x / 1.41f;
|
const float w = size.x / 1.41f;
|
||||||
const glm::vec4 tint (0.8f);
|
const glm::vec4 tint (0.8f);
|
||||||
|
|
||||||
face({x + xs, y, z + zs}, w, size.y, 0, {1, 0, 1}, {0, 1, 0}, glm::vec3(),
|
face({x + xs, y, z + zs}, w, size.y, 0, {-1, 0, 1}, {0, 1, 0}, glm::vec3(),
|
||||||
texface1, lights, tint);
|
texface1, lights2, tint);
|
||||||
face({x + xs, y, z + zs}, w, size.y, 0, {-1, 0, -1}, {0, 1, 0}, glm::vec3(),
|
face({x + xs, y, z + zs}, w, size.y, 0, {1, 0, 1}, {0, 1, 0}, glm::vec3(),
|
||||||
texface1, lights, tint);
|
texface1, lights1, tint);
|
||||||
|
|
||||||
|
face({x + xs, y, z + zs}, w, size.y, 0, {-1, 0, -1}, {0, 1, 0}, glm::vec3(),
|
||||||
|
texface2, lights2, tint);
|
||||||
face({x + xs, y, z + zs}, w, size.y, 0, {1, 0, -1}, {0, 1, 0}, glm::vec3(),
|
face({x + xs, y, z + zs}, w, size.y, 0, {1, 0, -1}, {0, 1, 0}, glm::vec3(),
|
||||||
texface2, lights, tint);
|
texface2, lights1, tint);
|
||||||
face({x + xs, y, z + zs}, w, size.y, 0, {-1, 0, 1}, {0, 1, 0}, glm::vec3(),
|
|
||||||
texface2, lights, tint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HINT: texture faces order: {east, west, bottom, top, south, north}
|
// HINT: texture faces order: {east, west, bottom, top, south, north}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user