summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--editor/imgui.cpp4
-rw-r--r--shaders/lightmap.cpp8
-rw-r--r--shaders/lightmap.frag2
-rw-r--r--shaders/lightmap.vert2
4 files changed, 4 insertions, 12 deletions
diff --git a/editor/imgui.cpp b/editor/imgui.cpp
index e0838d1c..ea76cc76 100644
--- a/editor/imgui.cpp
+++ b/editor/imgui.cpp
@@ -232,9 +232,7 @@ void app::draw_lightmap_test()
{
_testing_light = true;
shader.begin_occlusion();
-#if 0
- shader.add_chunk(chunk_offset, e_->chunk());
-#endif
+ shader.add_chunk(Vector2{}, e_->chunk()); // todo add neighbors
shader.end_occlusion();
shader.bind();
shader.add_light(L);
diff --git a/shaders/lightmap.cpp b/shaders/lightmap.cpp
index 77c5bd6c..bd4d2ec6 100644
--- a/shaders/lightmap.cpp
+++ b/shaders/lightmap.cpp
@@ -256,14 +256,12 @@ void lightmap_shader::add_light(const light_s& light)
auto center_clip = clip_start + center_fragcoord * clip_scale; // clip coordinates
float alpha = light.color.a() / 255.f;
- auto color = Vector3{light.color.rgb()} / 255.f;
+ auto color = (Vector3{light.color.rgb()} / 255.f) * alpha;
setUniform(SamplerUniform, TextureSampler);
- //setUniform(LightColorUniform, color * alpha);
- setUniform(LightColorUniform, Vector3{1});
+ setUniform(LightColorUniform, color * alpha);
setUniform(SizeUniform, 1 / chunk_size);
- //setUniform(CenterFragcoordUniform, center_fragcoord);
- setUniform(CenterFragcoordUniform, Vector2{512});
+ setUniform(CenterFragcoordUniform, center_fragcoord);
setUniform(CenterClipUniform, center_clip);
setUniform(IntensityUniform, I);
setUniform(FalloffUniform, (uint32_t)light.falloff);
diff --git a/shaders/lightmap.frag b/shaders/lightmap.frag
index 6cf1d841..1f8c5e01 100644
--- a/shaders/lightmap.frag
+++ b/shaders/lightmap.frag
@@ -28,8 +28,6 @@ void main() {
A = tmp*tmp / (L*L);
}
color = vec4(light_color.rgb, A);
- //A += 0.2;
- //color = vec4(vec3(A), 1);
}
else if (mode == 2) // blend
{
diff --git a/shaders/lightmap.vert b/shaders/lightmap.vert
index 6c1e3d73..900038c4 100644
--- a/shaders/lightmap.vert
+++ b/shaders/lightmap.vert
@@ -16,7 +16,6 @@ layout (location = 0) in vec3 position;
void main() {
vec2 pos = position.xy;
- /*
if (mode == 0)
{
vec2 dir = pos - center_clip;
@@ -27,6 +26,5 @@ void main() {
pos += dir_norm * position.z * 4;
}
}
- */
gl_Position = vec4(pos, 0, 1);
}