Guest User

Image Chunk Load Shader Godot

a guest
Apr 19th, 2024
965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. shader_type canvas_item;
  2.  
  3. uniform float image_load_percent : hint_range(0.0, 1.0, 0.01);
  4. uniform vec4 blank_color : source_color;
  5. uniform int image_columns = 4;
  6.  
  7. void fragment() {
  8. int total_image_blocks = image_columns * image_columns;
  9.  
  10. int x_pos = int(UV.x * float(image_columns));
  11. int y_pos = int(UV.y * float(image_columns));
  12. int current_index = y_pos * image_columns + x_pos;
  13.  
  14. bool section_loaded = image_load_percent > float(current_index) / float(total_image_blocks);
  15. if (section_loaded)
  16. COLOR = texture(TEXTURE, UV);
  17. else
  18. COLOR = blank_color;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment