| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- // Feather disable all
- function __BulbRendererDefineOverlayUnderlay()
- {
- __ambienceSpriteArray = [];
- __shadowOverlayArray = [];
- __lightOverlayArray = [];
-
- __AccumulateAmbienceSprite = function(_boundaryL, _boundaryT, _boundaryR, _boundaryB)
- {
- //Now draw ambience overlay sprites, if we have any
- var _size = array_length(__ambienceSpriteArray);
- if (_size > 0)
- {
- gpu_set_colorwriteenable(true, true, true, false);
-
- var _i = 0;
- repeat(_size)
- {
- var _weak = __ambienceSpriteArray[_i];
- if (!weak_ref_alive(_weak) || _weak.ref.__destroyed)
- {
- array_delete(__ambienceSpriteArray, _i, 1);
- }
- else
- {
- with(_weak.ref)
- {
- if (visible)
- {
- __CheckSpriteDimensions();
-
- //If this light is active, do some drawing
- if (__IsOnScreen(_boundaryL, _boundaryT, _boundaryR, _boundaryB))
- {
- draw_sprite_ext(sprite, image, x, y, xscale, yscale, angle, blend, alpha);
- }
- }
- }
-
- ++_i;
- }
- }
-
- gpu_set_colorwriteenable(true, true, true, true);
- }
- }
-
- __AccumulateShadowOverlay = function(_boundaryL, _boundaryT, _boundaryR, _boundaryB)
- {
- //Now draw shadow overlay sprites, if we have any
- var _size = array_length(__shadowOverlayArray);
- if (_size > 0)
- {
- //Leverage the fog system to force the colour of the sprites we draw (alpha channel passes through)
- gpu_set_fog(true, __GetAmbientColor(), 0, 0);
-
- //Don't touch the alpha channel
- gpu_set_colorwriteenable(true, true, true, false);
-
- var _i = 0;
- repeat(_size)
- {
- var _weak = __shadowOverlayArray[_i];
- if (!weak_ref_alive(_weak) || _weak.ref.__destroyed)
- {
- array_delete(__shadowOverlayArray, _i, 1);
- }
- else
- {
- with(_weak.ref)
- {
- if (visible)
- {
- __CheckSpriteDimensions();
-
- //If this light is active, do some drawing
- if (__IsOnScreen(_boundaryL, _boundaryT, _boundaryR, _boundaryB))
- {
- draw_sprite_ext(sprite, image, x, y, xscale, yscale, angle, c_white, alpha);
- }
- }
- }
-
- ++_i;
- }
- }
-
- //Reset render state
- gpu_set_fog(false, c_white, 0, 0);
- gpu_set_colorwriteenable(true, true, true, true);
- }
- }
-
- __AccumulateLightOverlay = function(_boundaryL, _boundaryT, _boundaryR, _boundaryB)
- {
- static _u_fIntensity = shader_get_uniform(__shdBulbIntensity, "u_fIntensity");
-
- shader_set(__shdBulbIntensity);
-
- //We use the overarching blend mode for the renderer
- gpu_set_blendmode(bm_add);
-
- //Don't touch the alpha channel though
- gpu_set_colorwriteenable(true, true, true, false);
-
- var _i = 0;
- repeat(array_length(__lightOverlayArray))
- {
- var _weak = __lightOverlayArray[_i];
- if (!weak_ref_alive(_weak) || _weak.ref.__destroyed)
- {
- array_delete(__lightOverlayArray, _i, 1);
- }
- else
- {
- with(_weak.ref)
- {
- if (visible)
- {
- __CheckSpriteDimensions();
-
- //If this light is active, do some drawing
- if (__IsOnScreen(_boundaryL, _boundaryT, _boundaryR, _boundaryB))
- {
- shader_set_uniform_f(_u_fIntensity, intensity);
- draw_sprite_ext(sprite, image, x, y, xscale, yscale, angle, blend, 1);
- }
- }
- }
-
- ++_i;
- }
- }
-
- //Reset render state
- shader_reset();
- gpu_set_fog(false, c_white, 0, 0);
- gpu_set_colorwriteenable(true, true, true, true);
- }
- }
|