combine quads
This commit is contained in:
parent
457d3e2d6b
commit
5bd181adc9
8 changed files with 181 additions and 116 deletions
shaders
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
layout(location = 0) flat in uvec2 fragRasterPos;
|
||||
layout(location = 0) in vec2 fragRasterPos;
|
||||
layout(location = 1) flat in uint fragVolumeStart;
|
||||
layout(location = 2) in vec3 origPosition;
|
||||
layout(location = 3) flat in uint facing;
|
||||
|
@ -109,6 +109,10 @@ uint sample_neighbor_from_scene_info(uint volume_start, uvec2 raster_pos, uint f
|
|||
return value;
|
||||
}
|
||||
|
||||
uint sample_neighbor_from_scene_info(uint volume_start, vec2 raster_pos, uint f) {
|
||||
return sample_neighbor_from_scene_info(volume_start, uvec2(uint(floor(raster_pos.x)), uint(floor(raster_pos.y))), f);
|
||||
}
|
||||
|
||||
uvec4 sample_color_from_scene_info(uint volume_start, uvec2 raster_pos, uint f) {
|
||||
uint array_descr_start = volume_start + 6 + max_num_lights;
|
||||
uint color_array_start = array_descr_start + 24;
|
||||
|
@ -148,6 +152,10 @@ uvec4 sample_color_from_scene_info(uint volume_start, uvec2 raster_pos, uint f)
|
|||
return unpack_color(value);
|
||||
}
|
||||
|
||||
uvec4 sample_color_from_scene_info(uint volume_start, vec2 raster_pos, uint f) {
|
||||
return sample_color_from_scene_info(volume_start, uvec2(uint(floor(raster_pos.x)), uint(floor(raster_pos.y))), f);
|
||||
}
|
||||
|
||||
vec3 get_light_position(uint light_index) {
|
||||
return vec3(uintBitsToFloat(scene_info.infos[light_index + 1]), uintBitsToFloat(scene_info.infos[light_index + 2]), uintBitsToFloat(scene_info.infos[light_index + 3]));
|
||||
}
|
||||
|
@ -333,7 +341,7 @@ Tracing trace_ray(uint volume_start, vec3 starting_pos, vec3 start_direction, fl
|
|||
vec3 visibility_after_reflection = refltective_color_mul * reflectivity;
|
||||
//break;
|
||||
//max(visibility_after_reflection.x, max(visibility_after_reflection.y, visibility_after_reflection.z)) >= 0.1 &&
|
||||
if (allow_reflect) {
|
||||
if (max(visibility_after_reflection.x, max(visibility_after_reflection.y, visibility_after_reflection.z)) >= 0.1 && allow_reflect) {
|
||||
// do reflect
|
||||
direction = reflect_vector(direction, hit_facing);
|
||||
pos = intersection_pos;
|
||||
|
@ -440,6 +448,10 @@ vec3 diffuse_tracing(uint volume_start, uvec2 raster_pos, vec3 pos, uint f) {
|
|||
return color_sum;
|
||||
}
|
||||
|
||||
vec3 diffuse_tracing(uint volume_start, vec2 raster_pos, vec3 pos, uint f) {
|
||||
return diffuse_tracing(volume_start, uvec2(uint(floor(raster_pos.x)), uint(floor(raster_pos.y))), pos, f);
|
||||
}
|
||||
|
||||
vec3 clamp_to_volume(uint volume_start, vec3 position) {
|
||||
uint volume_pos_x = scene_info.infos[volume_start + 0];
|
||||
uint volume_pos_y = scene_info.infos[volume_start + 1];
|
||||
|
@ -501,4 +513,5 @@ void main() {
|
|||
}
|
||||
|
||||
outColor = vec4(color_sum, 1.0);
|
||||
//outColor = vec4(orig_color_sample, 1.0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue