Skip to content

Commit

Permalink
add new opt
Browse files Browse the repository at this point in the history
  • Loading branch information
computermouth committed Nov 8, 2023
1 parent 85d47a4 commit cb579f0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion c1k3-assets
Submodule c1k3-assets updated 2 files
+ blend/map1.blend
+2,315 −2,598 blend/map1.gltf
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ int main(int argc, char* argv[]) {
return 1;
}
SDL_GL_CreateContext(window);
// SDL_GL_SetSwapInterval(0);
SDL_GL_SetSwapInterval(0);
// todo, vsync?

game_load();
Expand Down
14 changes: 6 additions & 8 deletions shader.frag
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
// Calculate all lights
"vec3 vl = vec3(0,0,0);"
"for(int i=0;i<light_count;i+=2) {"
"vl+="
// Angle to normal
"max("
"dot("
"vn, normalize(l[i]-vp)"
")"
",0.)*"
"(1./pow(length(l[i]-vp),2.))" // Inverse distance squared
"vec3 livp = l[i]-vp;"
"float c_len = length(livp);"
"float c_dot = dot(vn, normalize(livp));"
"if ( c_len > 1024. || c_dot < 0.) { continue; }"
"vl+= c_dot *"
"(1./pow(c_len,2.))" // Inverse distance squared
"*l[i+1];" // Light color/intensity
"}"

Expand Down

0 comments on commit cb579f0

Please sign in to comment.