Guest User

Untitled

a guest
Aug 27th, 2024
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. var c_x = o_Player.cam_x;
  2. var c_y = o_Player.cam_y;
  3.  
  4. //Create the light surface and set it as target
  5. if (!surface_exists(light_surf))
  6. light_surf = surface_create(room_width, room_height);
  7. surface_set_target(light_surf);
  8. camera_apply(cam);
  9.  
  10. //Clear the target surface to black
  11. draw_clear_alpha(c_black, .9);
  12.  
  13. //Set the shader
  14. shader_set(sh_Light);
  15.  
  16. //Set blendmode to multiply
  17. //gpu_set_blendmode_ext(bm_dest_color, bm_inv_src_alpha);
  18. gpu_set_blendmode(bm_add);
  19.  
  20. //Set the uniforms for each light object
  21. with (o_Light) {
  22.  
  23. shader_set_uniform_f(other.l_pos, x, y);
  24. shader_set_uniform_f(other.l_in_rad, in_rad);
  25. shader_set_uniform_f(other.l_out_rad, out_rad);
  26. shader_set_uniform_f(other.l_dir, dir);
  27. shader_set_uniform_f(other.l_fov, fov);
  28.  
  29. //Draw the app_surf
  30. draw_surface(application_surface, c_x, c_y);
  31. }
  32. //Reset blendmode and surface target
  33. surface_reset_target();
  34. gpu_set_blendmode(bm_normal);
  35.  
  36. //Draw the light_surf
  37. draw_surface(light_surf, c_x, c_y);
  38.  
  39. //Reset the shader
  40. shader_reset();
Advertisement
Add Comment
Please, Sign In to add comment