mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 15:01:49 +00:00
fix particles lighting
This commit is contained in:
parent
c6de7f62fe
commit
6be640458d
1 changed files with 22 additions and 3 deletions
|
|
@ -82,15 +82,34 @@ void ParticlesRenderer::renderParticles(const Camera& camera, float delta) {
|
||||||
}
|
}
|
||||||
update_particle(particle, delta, chunks);
|
update_particle(particle, delta, chunks);
|
||||||
|
|
||||||
|
float scale = 1.0f + ((particle.random ^ 2628172) % 1000) *
|
||||||
|
0.001f * preset.sizeSpread;
|
||||||
|
|
||||||
glm::vec4 light(1, 1, 1, 0);
|
glm::vec4 light(1, 1, 1, 0);
|
||||||
if (preset.lighting) {
|
if (preset.lighting) {
|
||||||
light = MainBatch::sampleLight(
|
light = MainBatch::sampleLight(
|
||||||
particle.position, chunks, backlight
|
particle.position,
|
||||||
|
chunks,
|
||||||
|
backlight
|
||||||
);
|
);
|
||||||
|
for (int x = -1; x <= 1; x++) {
|
||||||
|
for (int y = -1; y <= 1; y++) {
|
||||||
|
for (int z = -1; z <= 1; z++) {
|
||||||
|
light = glm::max(
|
||||||
|
light,
|
||||||
|
MainBatch::sampleLight(
|
||||||
|
particle.position - preset.size * scale *
|
||||||
|
glm::vec3(x, y, z),
|
||||||
|
chunks,
|
||||||
|
backlight
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
light *= 0.9f + (particle.random % 100) * 0.001f;
|
light *= 0.9f + (particle.random % 100) * 0.001f;
|
||||||
}
|
}
|
||||||
float scale = 1.0f + ((particle.random ^ 2628172) % 1000) *
|
|
||||||
0.001f * preset.sizeSpread;
|
|
||||||
|
|
||||||
glm::vec3 localRight = right;
|
glm::vec3 localRight = right;
|
||||||
glm::vec3 localUp = preset.globalUpVector ? glm::vec3(0, 1, 0) : up;
|
glm::vec3 localUp = preset.globalUpVector ? glm::vec3(0, 1, 0) : up;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue