From 34920ccec89382c926c4ff73031f73ae6b3a33ee Mon Sep 17 00:00:00 2001 From: XProger Date: Sat, 25 May 2019 06:56:40 +0300 Subject: [PATCH] fix shadow shader and ambient factors for pickups --- src/level.h | 21 +++++++++++++++------ src/shaders/compose.glsl | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/level.h b/src/level.h index af24048..ff75eed 100644 --- a/src/level.h +++ b/src/level.h @@ -1961,12 +1961,21 @@ struct Level : IGame { memcpy(controller->ambient, cube.colors, sizeof(cube.colors)); // store last calculated ambient into controller } } else { - controller->ambient[0] = - controller->ambient[1] = - controller->ambient[2] = - controller->ambient[3] = - controller->ambient[4] = - controller->ambient[5] = vec4(Core::active.material.y); + if (entity.isPickup()) { + controller->ambient[0] = + controller->ambient[1] = + controller->ambient[5] = + controller->ambient[4] = vec4(Core::active.material.y * 0.8f); + controller->ambient[2] = vec4(Core::active.material.y * 0.1f); + controller->ambient[3] = vec4(Core::active.material.y); + } else { + controller->ambient[0] = + controller->ambient[1] = + controller->ambient[2] = + controller->ambient[3] = + controller->ambient[4] = + controller->ambient[5] = vec4(Core::active.material.y); + } } Core::active.shader->setParam(uAmbient, controller->ambient[0], 6); } diff --git a/src/shaders/compose.glsl b/src/shaders/compose.glsl index abea468..06f74c2 100644 --- a/src/shaders/compose.glsl +++ b/src/shaders/compose.glsl @@ -13,7 +13,7 @@ R"====( #endif #ifdef OPT_SHADOW - #define SHADOW_TEXEL vec3(1.0 / 1024.0, 1.0 / 1024.0, 0.0) + #define SHADOW_TEXEL vec3(1.0 / 2048.0, 1.0 / 2048.0, 0.0) uniform mat4 uLightProj; #ifdef OPT_VLIGHTPROJ