commit c2e6c5984f4af27e1a31bed42defe2a11d9bc84e
parent 1d1863cdee559d5323e7fcef06e9c6e1f8d1c49b
Author: William Casarin <jb55@jb55.com>
Date: Wed, 2 May 2018 21:31:28 -0700
fixed lighting some more. no more gamma
Diffstat:
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/etc/shaders/test.f.glsl b/etc/shaders/test.f.glsl
@@ -55,6 +55,6 @@ void main() {
color = frag;
// fragmentColor = vec4(fog, 1.0);
// vec3 color = (v_color * v_light).xyz;
- fragmentColor = vec4(gamma_correct(color), 1.0);
+ fragmentColor = vec4(color, 1.0);
// }
}
diff --git a/etc/shaders/test.v.glsl b/etc/shaders/test.v.glsl
@@ -22,7 +22,7 @@ void main()
vec4 trans_normal = normal_matrix * vec4(normal, 1);
vec4 v4pos = vec4(position, 1.0);
gl_Position = mvp * v4pos;
- v_light = dot(trans_normal, vec4(light_dir, 0));
+ v_light = dot(trans_normal, vec4(normalize(light_dir), 0));
if (position.z <= 1.0)
v_color = vec4(0.0, 0.5, 0.79, 1.0);
diff --git a/src/game.c b/src/game.c
@@ -27,7 +27,7 @@ void game_init(struct game *game) {
struct terrain *terrain = &game->terrain;
mat4 *light_dir = game->test_resources.light_dir;
- const double size = 6000;
+ const double size = 10000;
const double pdist = 1.7;
terrain->settings = (struct perlin_settings){
@@ -48,9 +48,9 @@ void game_init(struct game *game) {
mat4_id(mvp);
- light_dir[0] = 0.5;
- light_dir[1] = 0.5;
- light_dir[2] = 0.5;
+ light_dir[0] = 0.8;
+ light_dir[1] = 0.8;
+ light_dir[2] = 0.8;
node_init(root);
node_init(player);
diff --git a/src/update.c b/src/update.c
@@ -226,10 +226,11 @@ void update (struct game *game, u32 dt) {
}
- /* res->light_dir[0] = fabs(cos(n)*0.2); */
- /* res->light_dir[1] = fabs(cos(n+50.0)*0.07); */
- /* res->light_dir[2] = fabs(cos(n+100.0)*0.2); */
- /* n += 0.01f; */
+ /* res->light_dir[0] = fabs(cos(n)); */
+ /* res->light_dir[1] = fabs(sin(n+50.0)); */
+ /* res->light_dir[2] = 1; */
+ /* res->light_dir[2] = fabs(sin(n+100.0)*cos(n)); */
+ n += 0.001f;
node_recalc(root);
}