Pixel-Composer/scripts/node_pb_fx/node_pb_fx.gml

29 lines
1.3 KiB
Plaintext
Raw Normal View History

2023-07-21 12:40:20 +02:00
function Node_PB_Fx(_x, _y, _group = noone) : Node_PB(_x, _y, _group) constructor {
name = "PB FX";
2023-07-23 20:21:35 +02:00
inputs[| 0] = nodeValue("pBox", self, JUNCTION_CONNECT.input, VALUE_TYPE.pbBox, noone)
2023-07-21 12:40:20 +02:00
.setVisible(true, true);
2023-07-23 20:21:35 +02:00
outputs[| 0] = nodeValue("pBox", self, JUNCTION_CONNECT.output, VALUE_TYPE.pbBox, noone);
}
#macro PB_FX_PBOX if(_output_index == 1) { \
var _surf = outputs[| 0].getValue(); \
if(is_array(_surf)) _surf = array_safe_get(_surf, _array_index); \
if(!is_surface(_surf)) return noone; \
\
var _pbox = new __pbBox(); \
\
2023-09-08 21:37:36 +02:00
_pbox.w = surface_get_width_safe(_surf); \
_pbox.h = surface_get_height_safe(_surf); \
2023-07-23 20:21:35 +02:00
\
2023-09-08 21:37:36 +02:00
_pbox.layer_w = surface_get_width_safe(_surf); \
_pbox.layer_h = surface_get_height_safe(_surf); \
2023-07-23 20:21:35 +02:00
\
_pbox.mask = surface_create(_pbox.w, _pbox.h); \
surface_set_shader(_pbox.mask, sh_pb_to_mask); \
2023-09-08 21:09:09 +02:00
draw_surface_safe(_surf, 0, 0); \
2023-07-23 20:21:35 +02:00
surface_reset_shader(); \
\
return _pbox; \
}