flare
|
@ -548,6 +548,7 @@
|
|||
{"name":"s_node_HSV","order":46,"path":"sprites/s_node_HSV/s_node_HSV.yy",},
|
||||
{"name":"node_point_move","order":8,"path":"scripts/node_point_move/node_point_move.yy",},
|
||||
{"name":"s_node_3d_cone","order":9,"path":"sprites/s_node_3d_cone/s_node_3d_cone.yy",},
|
||||
{"name":"sh_draw_grey_alpha","order":13,"path":"shaders/sh_draw_grey_alpha/sh_draw_grey_alpha.yy",},
|
||||
{"name":"__panel_empty","order":7,"path":"scripts/__panel_empty/__panel_empty.yy",},
|
||||
{"name":"s_node_compose","order":1,"path":"sprites/s_node_compose/s_node_compose.yy",},
|
||||
{"name":"s_node_switch","order":20,"path":"sprites/s_node_switch/s_node_switch.yy",},
|
||||
|
@ -724,6 +725,7 @@
|
|||
{"name":"luaHighlight","order":1,"path":"scripts/luaHighlight/luaHighlight.yy",},
|
||||
{"name":"d3d_rot3","order":3,"path":"scripts/d3d_rot3/d3d_rot3.yy",},
|
||||
{"name":"sh_sample_points","order":26,"path":"shaders/sh_sample_points/sh_sample_points.yy",},
|
||||
{"name":"sh_draw_flare_star","order":14,"path":"shaders/sh_draw_flare_star/sh_draw_flare_star.yy",},
|
||||
{"name":"node_voronoi_extra","order":24,"path":"scripts/node_voronoi_extra/node_voronoi_extra.yy",},
|
||||
{"name":"node_combine_rgb","order":1,"path":"scripts/node_combine_rgb/node_combine_rgb.yy",},
|
||||
{"name":"fd_rectangle_draw_part","order":10,"path":"scripts/fd_rectangle_draw_part/fd_rectangle_draw_part.yy",},
|
||||
|
@ -1123,6 +1125,7 @@
|
|||
{"name":"sh_color_select_content","order":1,"path":"shaders/sh_color_select_content/sh_color_select_content.yy",},
|
||||
{"name":"s_node_hlsl","order":32,"path":"sprites/s_node_hlsl/s_node_hlsl.yy",},
|
||||
{"name":"sh_outline","order":18,"path":"shaders/sh_outline/sh_outline.yy",},
|
||||
{"name":"node_mk_flare","order":12,"path":"scripts/node_mk_flare/node_mk_flare.yy",},
|
||||
{"name":"s_node_strandSim_break","order":8,"path":"sprites/s_node_strandSim_break/s_node_strandSim_break.yy",},
|
||||
{"name":"s_node_scatter_point","order":4,"path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",},
|
||||
{"name":"Obj_FirebaseFirestore_Collection_Query_NotEqual","order":9,"path":"objects/Obj_FirebaseFirestore_Collection_Query_NotEqual/Obj_FirebaseFirestore_Collection_Query_NotEqual.yy",},
|
||||
|
|
|
@ -777,6 +777,7 @@
|
|||
{"id":{"name":"s_node_HSV","path":"sprites/s_node_HSV/s_node_HSV.yy",},},
|
||||
{"id":{"name":"node_point_move","path":"scripts/node_point_move/node_point_move.yy",},},
|
||||
{"id":{"name":"s_node_3d_cone","path":"sprites/s_node_3d_cone/s_node_3d_cone.yy",},},
|
||||
{"id":{"name":"sh_draw_grey_alpha","path":"shaders/sh_draw_grey_alpha/sh_draw_grey_alpha.yy",},},
|
||||
{"id":{"name":"__panel_empty","path":"scripts/__panel_empty/__panel_empty.yy",},},
|
||||
{"id":{"name":"s_node_compose","path":"sprites/s_node_compose/s_node_compose.yy",},},
|
||||
{"id":{"name":"s_node_switch","path":"sprites/s_node_switch/s_node_switch.yy",},},
|
||||
|
@ -978,6 +979,7 @@
|
|||
{"id":{"name":"luaHighlight","path":"scripts/luaHighlight/luaHighlight.yy",},},
|
||||
{"id":{"name":"d3d_rot3","path":"scripts/d3d_rot3/d3d_rot3.yy",},},
|
||||
{"id":{"name":"sh_sample_points","path":"shaders/sh_sample_points/sh_sample_points.yy",},},
|
||||
{"id":{"name":"sh_draw_flare_star","path":"shaders/sh_draw_flare_star/sh_draw_flare_star.yy",},},
|
||||
{"id":{"name":"node_voronoi_extra","path":"scripts/node_voronoi_extra/node_voronoi_extra.yy",},},
|
||||
{"id":{"name":"node_combine_rgb","path":"scripts/node_combine_rgb/node_combine_rgb.yy",},},
|
||||
{"id":{"name":"fd_rectangle_draw_part","path":"scripts/fd_rectangle_draw_part/fd_rectangle_draw_part.yy",},},
|
||||
|
@ -1428,6 +1430,7 @@
|
|||
{"id":{"name":"sh_color_select_content","path":"shaders/sh_color_select_content/sh_color_select_content.yy",},},
|
||||
{"id":{"name":"s_node_hlsl","path":"sprites/s_node_hlsl/s_node_hlsl.yy",},},
|
||||
{"id":{"name":"sh_outline","path":"shaders/sh_outline/sh_outline.yy",},},
|
||||
{"id":{"name":"node_mk_flare","path":"scripts/node_mk_flare/node_mk_flare.yy",},},
|
||||
{"id":{"name":"s_node_strandSim_break","path":"sprites/s_node_strandSim_break/s_node_strandSim_break.yy",},},
|
||||
{"id":{"name":"s_node_scatter_point","path":"sprites/s_node_scatter_point/s_node_scatter_point.yy",},},
|
||||
{"id":{"name":"node_checkerboard","path":"scripts/node_checkerboard/node_checkerboard.yy",},},
|
||||
|
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
@ -21,20 +21,31 @@ function Node_MK_Blinker(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
|||
|
||||
inputs[| 7] = nodeValue("Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1 )
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
inputs[| 8] = nodeValue("Glow", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
|
||||
|
||||
inputs[| 9] = nodeValue("Size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 )
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range : [ 1, 8, 1 ] });
|
||||
|
||||
inputs[| 10] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 )
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Light only", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ new Inspector_Sprite(s_MKFX), 6,
|
||||
["Surfaces", false], 0, 1,
|
||||
["Blink", false], 2, 3, 4, 5, 7,
|
||||
["Surfaces", false], 0, 1,
|
||||
["Blink", false], 2, 3, 4, 5, 7,
|
||||
["Glow", true, 8], 9, 10,
|
||||
]
|
||||
|
||||
temp_surface = [ surface_create( 1, 1 ), surface_create( 1, 1 ), surface_create( 1, 1 ) ];
|
||||
|
||||
light_only = [];
|
||||
|
||||
surface_blur_init();
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
if(_output_index == 1) return light_only[_array_index];
|
||||
|
||||
|
@ -45,6 +56,9 @@ function Node_MK_Blinker(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
|||
var _trgC = _data[4];
|
||||
var _ligC = _data[5];
|
||||
var _tolr = _data[7];
|
||||
var _glow = _data[8];
|
||||
var _glsz = _data[9];
|
||||
var _glop = _data[10];
|
||||
|
||||
if(!is_surface(_surf)) return _outSurf;
|
||||
|
||||
|
@ -93,14 +107,22 @@ function Node_MK_Blinker(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
|
|||
BLEND_NORMAL
|
||||
surface_reset_target();
|
||||
|
||||
if(_glow) var lightBlur = surface_apply_gaussian(light_only[_array_index], _glsz, true, c_black, 1);
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
|
||||
BLEND_OVERRIDE
|
||||
|
||||
draw_surface(_surf, 0, 0);
|
||||
|
||||
if(_glow) {
|
||||
BLEND_ADD
|
||||
draw_surface_ext(lightBlur, 0, 0, 1, 1, 0, c_white, _glop);
|
||||
}
|
||||
|
||||
BLEND_ALPHA_MULP
|
||||
|
||||
draw_surface(temp_surface[2], 0, 0);
|
||||
|
||||
BLEND_NORMAL
|
||||
surface_reset_target();
|
||||
|
||||
|
|
|
@ -56,6 +56,12 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
inputs[| 20] = nodeValue("Twist Speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 10 ])
|
||||
.setDisplay(VALUE_DISPLAY.range);
|
||||
|
||||
inputs[| 21] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ])
|
||||
.setDisplay(VALUE_DISPLAY.range, { linked : true });
|
||||
|
||||
inputs[| 22] = nodeValue("Render Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Leaf", "Circle" ]);
|
||||
|
||||
outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
|
@ -64,7 +70,7 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
["Spawn", false], 3, 4,
|
||||
["Physics", false], 10, 5, 12,
|
||||
["Swing", false], 8, 6, 7, 11, 17,
|
||||
["Render", false], 9, 13, 14,
|
||||
["Render", false], 22, 9, 21, 13, 14,
|
||||
["Ground", true, 15], 16,
|
||||
["Twist", true, 18], 19, 20,
|
||||
];
|
||||
|
@ -81,8 +87,9 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
_twistr = 0.01;
|
||||
_twists = [ 0, 0 ];
|
||||
_ground = noone;
|
||||
_scale = [ 0, 0 ];
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
|
||||
if(getInputData(15)) {
|
||||
|
@ -94,13 +101,21 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
draw_line(0, _y0, 999999, _y0);
|
||||
draw_line(0, _y1, 999999, _y1);
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static getPosition = function(ind, t, _area) { #region
|
||||
random_set_seed(ind);
|
||||
|
||||
var _px = irandom_range(_area[0] - _area[2], _area[0] + _area[2]);
|
||||
var _py = irandom_range(_area[1] - _area[3], _area[1] + _area[3]);
|
||||
var _px = _area[0], _py = _area[1];
|
||||
|
||||
if(_area[4] == 0) {
|
||||
_px = irandom_range(_area[0] - _area[2], _area[0] + _area[2]);
|
||||
_py = irandom_range(_area[1] - _area[3], _area[1] + _area[3]);
|
||||
} else if(_area[4] == 1) {
|
||||
var _dir = random(360);
|
||||
_px = _area[0] + lengthdir_x(_area[2], _dir);
|
||||
_py = _area[1] + lengthdir_y(_area[3], _dir);
|
||||
}
|
||||
|
||||
var _sg = choose(1, -1);
|
||||
|
||||
|
@ -124,9 +139,10 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
var _p0 = [ 0, 0 ];
|
||||
var _p1 = [ _px, _py ];
|
||||
var _frc = 1;
|
||||
var life = 0;
|
||||
|
||||
for(var i = -2; i < t; i++) {
|
||||
var _i = i / TOTAL_FRAMES * pi * 4;
|
||||
var _i = life / TOTAL_FRAMES * pi * 4;
|
||||
|
||||
if(_curving != 0) {
|
||||
_cvdr += _curving;
|
||||
|
@ -134,13 +150,13 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
_vx = lengthdir_x(_cvrr, _cvdr);
|
||||
_vy = lengthdir_y(_cvrr, _cvdr);
|
||||
|
||||
_cvrr *= 0.95;
|
||||
_cvrr *= 0.975;
|
||||
_curving = clamp(_curving * 1.05, -10, 10);
|
||||
|
||||
if(abs(_cvdr - _cvds) > 300) _curving = 0;
|
||||
} else {
|
||||
_vx = sin(_sw * _sp * _i) * _sg * _sx * (1 + i / TOTAL_FRAMES * _nx);
|
||||
_vy += sin(_sw / _sp * _i * 2) * _sy * (1 + i / TOTAL_FRAMES * _ny);
|
||||
_vx = sin(_sw * _sp * _i) * _sg * _sx * (1 + life / TOTAL_FRAMES * _nx);
|
||||
_vy += sin(_sw / _sp * _i * 2) * _sy * (1 + life / TOTAL_FRAMES * _ny);
|
||||
|
||||
if(_twist && random(1) < _twistr) {
|
||||
_curving = random_range(_twists[0], _twists[1]) * sign(_vx);
|
||||
|
@ -150,6 +166,8 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
if(abs(_curving) <= 1) _curving = 0;
|
||||
}
|
||||
|
||||
life++;
|
||||
}
|
||||
|
||||
if(_frc >= 0.2) {
|
||||
|
@ -171,6 +189,12 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
return [ _p0, _p1, [ _px, _py ] ];
|
||||
} #endregion
|
||||
|
||||
static step = function() { #region
|
||||
var _typ = getInputData(22);
|
||||
|
||||
inputs[| 9].setVisible(_typ == 0);
|
||||
} #endregion
|
||||
|
||||
static update = function() { #region
|
||||
var _surf = getInputData(0);
|
||||
var _dim = getInputData(1);
|
||||
|
@ -192,6 +216,8 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
_twist = getInputData(18);
|
||||
_twistr = getInputData(19);
|
||||
_twists = getInputData(20);
|
||||
_scale = getInputData(21);
|
||||
var _rtyp = getInputData(22);
|
||||
|
||||
_twistr = _twistr * _twistr * _twistr;
|
||||
|
||||
|
@ -226,14 +252,18 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
var _dr0 = point_direction(_p1[0], _p1[1], _p0[0], _p0[1]);
|
||||
var _dr2 = point_direction(_p1[0], _p1[1], _p2[0], _p2[1]);
|
||||
|
||||
var _p11 = [ _p1[0] + lengthdir_x(_size[1], _dr0 + 90),
|
||||
_p1[1] + lengthdir_y(_size[1], _dr0 + 90) ];
|
||||
var _p12 = [ _p1[0] + lengthdir_x(_size[1], _dr0 - 90),
|
||||
_p1[1] + lengthdir_y(_size[1], _dr0 - 90) ];
|
||||
var _p00 = [ _p1[0] + lengthdir_x(_size[0], _dr0),
|
||||
_p1[1] + lengthdir_y(_size[0], _dr0) ];
|
||||
var _p22 = [ _p1[0] + lengthdir_x(_size[0], _dr2),
|
||||
_p1[1] + lengthdir_y(_size[0], _dr2) ];
|
||||
var _sc = random_range_seed(_scale[0], _scale[1], _sed + 20);
|
||||
var _sx = _size[0] * _sc;
|
||||
var _sy = _size[1] * _sc;
|
||||
|
||||
var _p11 = [ _p1[0] + lengthdir_x(_sy, _dr0 + 90),
|
||||
_p1[1] + lengthdir_y(_sy, _dr0 + 90) ];
|
||||
var _p12 = [ _p1[0] + lengthdir_x(_sy, _dr0 - 90),
|
||||
_p1[1] + lengthdir_y(_sy, _dr0 - 90) ];
|
||||
var _p00 = [ _p1[0] + lengthdir_x(_sx, _dr0),
|
||||
_p1[1] + lengthdir_y(_sx, _dr0) ];
|
||||
var _p22 = [ _p1[0] + lengthdir_x(_sx, _dr2),
|
||||
_p1[1] + lengthdir_y(_sx, _dr2) ];
|
||||
|
||||
var _cc = _colr.eval(_ind);
|
||||
var _aa = eval_curve_x(_alph, _lif / TOTAL_FRAMES);
|
||||
|
@ -241,14 +271,18 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
draw_set_color(_cc);
|
||||
draw_set_alpha(_aa);
|
||||
|
||||
draw_primitive_begin(pr_trianglestrip);
|
||||
if(_rtyp == 0) {
|
||||
draw_primitive_begin(pr_trianglestrip);
|
||||
|
||||
draw_vertex(_p00[0], _p00[1]);
|
||||
draw_vertex(_p11[0], _p11[1]);
|
||||
draw_vertex(_p12[0], _p12[1]);
|
||||
draw_vertex(_p22[0], _p22[1]);
|
||||
draw_vertex(_p00[0], _p00[1]);
|
||||
draw_vertex(_p11[0], _p11[1]);
|
||||
draw_vertex(_p12[0], _p12[1]);
|
||||
draw_vertex(_p22[0], _p22[1]);
|
||||
|
||||
draw_primitive_end();
|
||||
draw_primitive_end();
|
||||
} else if(_rtyp == 1) {
|
||||
draw_circle_prec(_p0[0], _p0[1], _sc, false, 16);
|
||||
}
|
||||
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
|
|
305
scripts/node_mk_flare/node_mk_flare.gml
Normal file
|
@ -0,0 +1,305 @@
|
|||
function Node_MK_Flare(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "MK Lens Flare";
|
||||
dimension_index = 3;
|
||||
|
||||
inputs[| 0] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| 1] = nodeValue("Origin", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ DEF_SURF_W / 2, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 2] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Lens", "Crescent" ]);
|
||||
|
||||
inputs[| 3] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_SURF)
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 4] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
|
||||
inputs[| 5] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Light only", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ new Inspector_Sprite(s_MKFX),
|
||||
["Surfaces", false], 0, 3,
|
||||
["Flare", false], 2, 1, 4,
|
||||
["Render", false], 5,
|
||||
]
|
||||
|
||||
temp_surface = [ surface_create(1, 1) ];
|
||||
seed = seed_random();
|
||||
|
||||
flares = [];
|
||||
|
||||
ox = 0;
|
||||
oy = 0;
|
||||
cx = 0
|
||||
cy = 0
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
} #endregion
|
||||
|
||||
static flare_circle = function(_t, _r, _a, _side = 16, _angle = 0, _s0 = 0, _s1 = 0) { #region
|
||||
var _x = lerp(ox, cx, _t);
|
||||
var _y = lerp(oy, cy, _t);
|
||||
|
||||
temp_surface[0] = surface_verify(temp_surface[0], _r * 2, _r * 2);
|
||||
|
||||
surface_set_shader(temp_surface[0], sh_draw_grey_alpha);
|
||||
shader_set_f("smooth", _s0, _s1);
|
||||
draw_primitive_begin(pr_trianglelist);
|
||||
|
||||
for( var i = 0; i < _side; i++ ) {
|
||||
var a0 = ((i + 0.0) / _side) * 360 + _angle;
|
||||
var a1 = ((i + 1.0) / _side) * 360 + _angle;
|
||||
|
||||
draw_vertex_color(_r, _r, c_white, 1)
|
||||
draw_vertex_color(_r + lengthdir_x(_r, a0), _r + lengthdir_y(_r, a0), c_black, 1)
|
||||
draw_vertex_color(_r + lengthdir_x(_r, a1), _r + lengthdir_y(_r, a1), c_black, 1)
|
||||
}
|
||||
|
||||
draw_primitive_end();
|
||||
surface_reset_shader();
|
||||
|
||||
BLEND_ADD draw_surface_ext(temp_surface[0], _x - _r, _y - _r, 1, 1, 0, c_white, _a);
|
||||
} #endregion
|
||||
|
||||
static flare_crescent = function(_t, _ir, _or, _a, _dist = 0, _angle = 0, _s0 = 0, _s1 = 0) { #region
|
||||
var _x = lerp(ox, cx, _t);
|
||||
var _y = lerp(oy, cy, _t);
|
||||
|
||||
var _r = _or;
|
||||
|
||||
temp_surface[0] = surface_verify(temp_surface[0], _r * 2, _r * 2);
|
||||
|
||||
surface_set_shader(temp_surface[0], sh_draw_grey_alpha);
|
||||
shader_set_f("smooth", _s0, _s1);
|
||||
|
||||
draw_circle_color(_r, _r, _or, c_white, c_black, false);
|
||||
|
||||
var _rx = _r + lengthdir_x(_dist, _angle);
|
||||
var _ry = _r + lengthdir_y(_dist, _angle);
|
||||
|
||||
BLEND_SUBTRACT
|
||||
draw_circle_color(_rx, _ry, _ir, c_white, c_black, false);
|
||||
BLEND_NORMAL
|
||||
surface_reset_shader();
|
||||
|
||||
BLEND_ADD draw_surface_ext(temp_surface[0], _x - _r, _y - _r, 1, 1, 0, c_white, _a);
|
||||
} #endregion
|
||||
|
||||
static flare_blur = function(_t, _r, _a, _s0 = 0, _s1 = 1) { #region
|
||||
var _x = lerp(ox, cx, _t);
|
||||
var _y = lerp(oy, cy, _t);
|
||||
|
||||
temp_surface[0] = surface_verify(temp_surface[0], _r * 2, _r * 2);
|
||||
|
||||
surface_set_shader(temp_surface[0], sh_draw_grey_alpha);
|
||||
shader_set_f("smooth", _s0, _s1);
|
||||
|
||||
draw_circle_color(_r - 1, _r - 1, _r, c_white, c_black, false);
|
||||
surface_reset_shader();
|
||||
|
||||
BLEND_ADD draw_surface_ext(temp_surface[0], _x - _r, _y - _r, 1, 1, 0, c_white, _a);
|
||||
} #endregion
|
||||
|
||||
static flare_ring = function(_t, _r, _a, _th, _s0 = 0, _s1 = 0) { #region
|
||||
var _x = lerp(ox, cx, _t);
|
||||
var _y = lerp(oy, cy, _t);
|
||||
|
||||
temp_surface[0] = surface_verify(temp_surface[0], _r * 2, _r * 2);
|
||||
|
||||
var _side = 32;
|
||||
var _r0 = _r - _th;
|
||||
var _r1 = _r - _th / 2;
|
||||
var _r2 = _r;
|
||||
|
||||
surface_set_shader(temp_surface[0], sh_draw_grey_alpha);
|
||||
shader_set_f("smooth", _s0, _s1);
|
||||
draw_primitive_begin(pr_trianglelist);
|
||||
|
||||
for( var i = 0; i < _side; i++ ) {
|
||||
var a0 = ((i + 0.0) / _side) * 360;
|
||||
var a1 = ((i + 1.0) / _side) * 360;
|
||||
|
||||
draw_vertex_color(_r + lengthdir_x(_r1, a0), _r + lengthdir_y(_r1, a0), c_white, 1);
|
||||
draw_vertex_color(_r + lengthdir_x(_r0, a0), _r + lengthdir_y(_r0, a0), c_black, 1);
|
||||
draw_vertex_color(_r + lengthdir_x(_r1, a1), _r + lengthdir_y(_r1, a1), c_white, 1);
|
||||
|
||||
draw_vertex_color(_r + lengthdir_x(_r0, a0), _r + lengthdir_y(_r0, a0), c_black, 1);
|
||||
draw_vertex_color(_r + lengthdir_x(_r1, a1), _r + lengthdir_y(_r1, a1), c_white, 1);
|
||||
draw_vertex_color(_r + lengthdir_x(_r0, a1), _r + lengthdir_y(_r0, a1), c_black, 1);
|
||||
|
||||
draw_vertex_color(_r + lengthdir_x(_r1, a0), _r + lengthdir_y(_r1, a0), c_white, 1);
|
||||
draw_vertex_color(_r + lengthdir_x(_r2, a0), _r + lengthdir_y(_r2, a0), c_black, 1);
|
||||
draw_vertex_color(_r + lengthdir_x(_r1, a1), _r + lengthdir_y(_r1, a1), c_white, 1);
|
||||
|
||||
draw_vertex_color(_r + lengthdir_x(_r2, a0), _r + lengthdir_y(_r2, a0), c_black, 1);
|
||||
draw_vertex_color(_r + lengthdir_x(_r1, a1), _r + lengthdir_y(_r1, a1), c_white, 1);
|
||||
draw_vertex_color(_r + lengthdir_x(_r2, a1), _r + lengthdir_y(_r2, a1), c_black, 1);
|
||||
}
|
||||
|
||||
draw_primitive_end();
|
||||
surface_reset_shader();
|
||||
|
||||
BLEND_ADD draw_surface_ext(temp_surface[0], _x - _r, _y - _r, 1, 1, 0, c_white, _a);
|
||||
} #endregion
|
||||
|
||||
static flare_star = function(_t, _ir, _or, _a, _amo, _rand = 1., _ang = 0) { #region
|
||||
var _x = lerp(ox, cx, _t);
|
||||
var _y = lerp(oy, cy, _t);
|
||||
|
||||
temp_surface[0] = surface_verify(temp_surface[0], _or * 2, _or * 2);
|
||||
|
||||
var cc = _or;
|
||||
|
||||
surface_set_shader(temp_surface[0], sh_draw_grey_alpha);
|
||||
draw_primitive_begin(pr_trianglelist);
|
||||
random_set_seed(seed);
|
||||
|
||||
for( var i = 0; i < _amo; i++ ) {
|
||||
var a0 = ((i + 0.0) / _amo) * 360 + _ang;
|
||||
var a1 = ((i + random_range(0., 1.)) / _amo) * 360 + _ang;
|
||||
var a2 = ((i + 1.0) / _amo) * 360 + _ang;
|
||||
|
||||
draw_vertex_color(cc, cc, c_white, 1);
|
||||
draw_vertex_color(cc + lengthdir_x(_ir, a0), cc + lengthdir_y(_ir, a0), c_grey, 1);
|
||||
draw_vertex_color(cc + lengthdir_x(_or, a1), cc + lengthdir_y(_or, a1), c_black, 1);
|
||||
|
||||
draw_vertex_color(cc, cc, c_white, 1);
|
||||
draw_vertex_color(cc + lengthdir_x(_or, a1), cc + lengthdir_y(_or, a1), c_black, 1);
|
||||
draw_vertex_color(cc + lengthdir_x(_ir, a2), cc + lengthdir_y(_ir, a2), c_grey, 1);
|
||||
}
|
||||
|
||||
draw_primitive_end();
|
||||
surface_reset_shader();
|
||||
|
||||
BLEND_ADD draw_surface_ext(temp_surface[0], _x - _or, _y - _or, 1, 1, 0, c_white, _a);
|
||||
} #endregion
|
||||
|
||||
static flare_line = function(_r, _a, _th, _dir) { #region
|
||||
var _x = cx;
|
||||
var _y = cy;
|
||||
|
||||
temp_surface[0] = surface_verify(temp_surface[0], _r * 2, _r * 2);
|
||||
|
||||
surface_set_shader(temp_surface[0], sh_draw_grey_alpha);
|
||||
shader_set_f("smooth", 0, 1);
|
||||
|
||||
draw_primitive_begin(pr_trianglelist);
|
||||
|
||||
var x0 = _r + lengthdir_x(_r, _dir);
|
||||
var y0 = _r + lengthdir_y(_r, _dir);
|
||||
var x1 = _r + lengthdir_x(_th, _dir + 90);
|
||||
var y1 = _r + lengthdir_y(_th, _dir + 90);
|
||||
var x2 = _r + lengthdir_x(_th, _dir + 270);
|
||||
var y2 = _r + lengthdir_y(_th, _dir + 270);
|
||||
var x3 = _r + lengthdir_x(_r, _dir + 180);
|
||||
var y3 = _r + lengthdir_y(_r, _dir + 180);
|
||||
|
||||
draw_vertex_color(_r, _r, c_white, 1);
|
||||
draw_vertex_color(x0, y0, c_black, 1);
|
||||
draw_vertex_color(x1, y1, c_black, 1);
|
||||
|
||||
draw_vertex_color(_r, _r, c_white, 1);
|
||||
draw_vertex_color(x0, y0, c_black, 1);
|
||||
draw_vertex_color(x2, y2, c_black, 1);
|
||||
|
||||
draw_vertex_color(_r, _r, c_white, 1);
|
||||
draw_vertex_color(x3, y3, c_black, 1);
|
||||
draw_vertex_color(x1, y1, c_black, 1);
|
||||
|
||||
draw_vertex_color(_r, _r, c_white, 1);
|
||||
draw_vertex_color(x3, y3, c_black, 1);
|
||||
draw_vertex_color(x2, y2, c_black, 1);
|
||||
|
||||
draw_primitive_end();
|
||||
surface_reset_shader();
|
||||
|
||||
BLEND_ADD draw_surface_ext(temp_surface[0], _x - _r, _y - _r, 1, 1, 0, c_white, _a);
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
if(_output_index == 1) return flares[_array_index];
|
||||
|
||||
var _surf = _data[0];
|
||||
var _origin = _data[1];
|
||||
var _type = _data[2];
|
||||
var _dim = _data[3];
|
||||
var _s = _data[4];
|
||||
var _a = _data[5];
|
||||
|
||||
var _bg = is_surface(_surf);
|
||||
|
||||
var _sw = _bg? surface_get_width_safe(_surf) : _dim[0];
|
||||
var _sh = _bg? surface_get_height_safe(_surf) : _dim[1];
|
||||
|
||||
var _focus = [ _sw / 2, _sh / 2 ];
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _sw, _sh);
|
||||
flares[_array_index] = surface_verify(array_safe_get(flares, _array_index), _sw, _sh);
|
||||
|
||||
ox = _origin[0];
|
||||
oy = _origin[1];
|
||||
cx = _focus[0];
|
||||
cy = _focus[1];
|
||||
|
||||
var _dir = point_direction(cx, cy, ox, oy);
|
||||
var _dis = point_distance(cx, cy, ox, oy);
|
||||
|
||||
var _x, _y;
|
||||
|
||||
surface_set_target(flares[_array_index]);
|
||||
draw_clear_alpha(c_white, 0);
|
||||
|
||||
switch(_type) {
|
||||
case 0 :
|
||||
flare_blur( 0, 10 * _s, 0.75 * _a);
|
||||
flare_blur( 0, 16 * _s, 0.5 * _a);
|
||||
flare_star( 0, 3 * _s, 16 * _s, 0.4 * _a, min(24, 12 * _s), 0.85, _dir);
|
||||
flare_ring( 0, 6 * _s, 0.25 * _a, 1 + 0.25 * _s, 0, 0.5);
|
||||
|
||||
flare_blur( 0.7, 2.0 * _s, 0.5 * _a, 0, 0.25);
|
||||
flare_circle(0.9, 2.0 * _s, 0.5 * _a, 6, _dir, 0, 0.1);
|
||||
flare_circle(1.2, 0.5 * _s, 0.3 * _a);
|
||||
|
||||
flare_blur( 1.5, 5 * _s, 0.4 * _a, 0, 0.7);
|
||||
flare_circle(1.6, 3 * _s, 0.4 * _a, 6, _dir);
|
||||
flare_ring( 1.9, 4 * _s, 0.3 * _a, 1 + 0.25 * _s, 0, 0.5);
|
||||
flare_blur( 1.9, 3 * _s, 0.3 * _a, 0, 0.5);
|
||||
break;
|
||||
case 1 :
|
||||
flare_crescent(0.5, 7.2 * _s, 7.5 * _s, 0.8 * _a, -0.2 * _s, _dir, 0.15, 0.2);
|
||||
flare_crescent(0.7, 4.7 * _s, 5 * _s, 0.6 * _a, -0.2 * _s, _dir, 0.15, 0.2);
|
||||
|
||||
flare_circle( 1.35, 2.0 * _s, 0.6 * _a, 32, 0, 0.4, 0.6);
|
||||
flare_circle( 1.5 , 3.0 * _s, 0.4 * _a, 32, 0, 0.1, 0.2);
|
||||
flare_ring( 1.75, 4.0 * _s, 0.6 * _a, 0.2 * _s, 0.1, 0.2);
|
||||
|
||||
flare_line(_dis * 1.0, 0.6 * _a, 1 + 0.25 * _s, _dir);
|
||||
break;
|
||||
}
|
||||
|
||||
BLEND_NORMAL
|
||||
surface_reset_target();
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
draw_clear_alpha(c_white, 0);
|
||||
|
||||
if(_bg) {
|
||||
BLEND_OVERRIDE
|
||||
draw_surface(_surf, 0, 0);
|
||||
}
|
||||
|
||||
BLEND_ADD
|
||||
draw_surface(flares[_array_index], 0, 0);
|
||||
|
||||
BLEND_NORMAL
|
||||
surface_reset_target();
|
||||
|
||||
return _outSurf;
|
||||
}
|
||||
}
|
11
scripts/node_mk_flare/node_mk_flare.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_mk_flare",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "MK effects",
|
||||
"path": "folders/nodes/data/MK effects.yy",
|
||||
},
|
||||
}
|
|
@ -1058,6 +1058,8 @@ function __initNodes() {
|
|||
addNodeObject(hid, "Sort Input", s_node_sort_array, "Node_Iterator_Sort_Inline_Input", [1, Node_Iterator_Sort_Inline_Input]).hideRecent();
|
||||
addNodeObject(hid, "Sort Output", s_node_sort_array, "Node_Iterator_Sort_Inline_Output", [1, Node_Iterator_Sort_Inline_Output]).hideRecent();
|
||||
|
||||
addNodeObject(hid, "MK Lens Flare", s_node_mk_blinker, "Node_MK_Flare", [1, Node_MK_Flare]).setVersion(11630);
|
||||
|
||||
ds_list_add(hid, "DynaSurf");
|
||||
addNodeObject(hid, "Input", s_node_pixel_builder, "Node_DynaSurf_In", [1, Node_DynaSurf_In]).hideRecent();
|
||||
addNodeObject(hid, "Output", s_node_pixel_builder, "Node_DynaSurf_Out", [1, Node_DynaSurf_Out]).hideRecent();
|
||||
|
|
8
shaders/sh_draw_flare_star/sh_draw_flare_star.fsh
Normal file
|
@ -0,0 +1,8 @@
|
|||
varying vec4 v_vColour;
|
||||
|
||||
float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(21.456, 46.856), vec2(12.989, 78.233))) * 43758.545); }
|
||||
|
||||
void main() {
|
||||
float grey = (v_vColour.r + v_vColour.g + v_vColour.b) / 3. * v_vColour.a;
|
||||
gl_FragColor = vec4(vec3(1.), grey);
|
||||
}
|
15
shaders/sh_draw_flare_star/sh_draw_flare_star.vsh
Normal file
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// Simple passthrough vertex shader
|
||||
//
|
||||
attribute vec3 in_Position; // (x,y,z)
|
||||
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
|
||||
attribute vec4 in_Colour; // (r,g,b,a)
|
||||
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main() {
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
v_vColour = in_Colour;
|
||||
}
|
10
shaders/sh_draw_flare_star/sh_draw_flare_star.yy
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"resourceType": "GMShader",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "sh_draw_flare_star",
|
||||
"parent": {
|
||||
"name": "draw",
|
||||
"path": "folders/shader/draw.yy",
|
||||
},
|
||||
"type": 1,
|
||||
}
|
10
shaders/sh_draw_grey_alpha/sh_draw_grey_alpha.fsh
Normal file
|
@ -0,0 +1,10 @@
|
|||
varying vec4 v_vColour;
|
||||
|
||||
uniform vec2 smooth;
|
||||
|
||||
void main() {
|
||||
float grey = (v_vColour.r + v_vColour.g + v_vColour.b) / 3. * v_vColour.a;
|
||||
grey = smoothstep(smooth.x, smooth.y, grey);
|
||||
|
||||
gl_FragColor = vec4(vec3(1.), grey);
|
||||
}
|
15
shaders/sh_draw_grey_alpha/sh_draw_grey_alpha.vsh
Normal file
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// Simple passthrough vertex shader
|
||||
//
|
||||
attribute vec3 in_Position; // (x,y,z)
|
||||
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
|
||||
attribute vec4 in_Colour; // (r,g,b,a)
|
||||
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main() {
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
v_vColour = in_Colour;
|
||||
}
|
10
shaders/sh_draw_grey_alpha/sh_draw_grey_alpha.yy
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"resourceType": "GMShader",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "sh_draw_grey_alpha",
|
||||
"parent": {
|
||||
"name": "draw",
|
||||
"path": "folders/shader/draw.yy",
|
||||
},
|
||||
"type": 1,
|
||||
}
|