Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var c_x = o_Player.cam_x;
- var c_y = o_Player.cam_y;
- //Create the light surface and set it as target
- if (!surface_exists(light_surf))
- light_surf = surface_create(room_width, room_height);
- surface_set_target(light_surf);
- camera_apply(cam);
- //Clear the target surface to black
- draw_clear_alpha(c_black, .9);
- //Set the shader
- shader_set(sh_Light);
- //Set blendmode to multiply
- //gpu_set_blendmode_ext(bm_dest_color, bm_inv_src_alpha);
- gpu_set_blendmode(bm_add);
- //Set the uniforms for each light object
- with (o_Light) {
- shader_set_uniform_f(other.l_pos, x, y);
- shader_set_uniform_f(other.l_in_rad, in_rad);
- shader_set_uniform_f(other.l_out_rad, out_rad);
- shader_set_uniform_f(other.l_dir, dir);
- shader_set_uniform_f(other.l_fov, fov);
- //Draw the app_surf
- draw_surface(application_surface, c_x, c_y);
- }
- //Reset blendmode and surface target
- surface_reset_target();
- gpu_set_blendmode(bm_normal);
- //Draw the light_surf
- draw_surface(light_surf, c_x, c_y);
- //Reset the shader
- shader_reset();
Advertisement
Add Comment
Please, Sign In to add comment