aspiojsanfopinaogpinhaeogfl

This commit is contained in:
Piotrek
2021-04-19 23:28:20 +02:00
parent 3fb2557a30
commit 5e968d0a30
7 changed files with 100 additions and 37 deletions
Binary file not shown.
+3 -3
View File
@@ -19,7 +19,7 @@ vec3 solve(vec3 point, vec3 view, vec3 normal)
return (ambient + diffuse + specular) * object_color;
}
vec3 raycast(vec3 origin, vec3 dir)
vec3 castNodes(vec3 origin, vec3 dir)
{
// Round input pos to nearest voxel
vec3 pos = floor(origin);
@@ -48,9 +48,9 @@ vec3 raycast(vec3 origin, vec3 dir)
vec3 normal = -incAxis * raySign;
// Get subnode
return step(vec3(0.5, 0.5, 0.5), point - pos);
//return step(vec3(0.5, 0.5, 0.5), point - pos);
//return solve(point, dir, normal);
return solve(point, dir, normal);
}
// Get new closest axis to increment
+1 -1
View File
@@ -33,5 +33,5 @@ void main()
vec3 ray_dir = normalize(view_matrix * vec4(view_dir,0)).xyz;
// Raycast
out_color = vec4(raycast(cam_pos, ray_dir), 1.0);
out_color = vec4(castNodes(cam_pos, ray_dir), 1.0);
}