2023-04-16 15:26:52 +02:00
|
|
|
function Node_Atlas_Draw(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|
|
|
name = "Draw Atlas";
|
|
|
|
previewable = true;
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(0, nodeValue_Dimension(self));
|
2023-04-16 15:26:52 +02:00
|
|
|
|
2024-08-18 09:13:41 +02:00
|
|
|
newInput(1, nodeValue_Surface("Atlas", self))
|
2023-04-16 15:26:52 +02:00
|
|
|
.setVisible(true, true);
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
outputs[0] = nodeValue_Output("Surface", self, VALUE_TYPE.surface, noone);
|
2023-04-16 15:26:52 +02:00
|
|
|
|
|
|
|
attribute_interpolation(true);
|
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
static update = function(frame = CURRENT_FRAME) {
|
2023-10-02 08:57:44 +02:00
|
|
|
var dim = getInputData(0);
|
|
|
|
var atl = getInputData(1);
|
2023-04-16 15:26:52 +02:00
|
|
|
|
|
|
|
if(atl == noone) return;
|
|
|
|
if(is_array(atl) && array_length(atl) == 0) return;
|
|
|
|
|
|
|
|
if(!is_array(atl))
|
|
|
|
atl = [ atl ];
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
var outSurf = outputs[0].getValue();
|
2023-04-16 15:26:52 +02:00
|
|
|
outSurf = surface_verify(outSurf, dim[0], dim[1]);
|
2024-08-08 06:57:51 +02:00
|
|
|
outputs[0].setValue(outSurf);
|
2023-04-16 15:26:52 +02:00
|
|
|
|
2023-06-10 13:59:45 +02:00
|
|
|
surface_set_shader(outSurf,,, BLEND.alpha);
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(atl); i < n; i++ ) {
|
2023-10-06 11:51:11 +02:00
|
|
|
shader_set_interpolation(atl[i].getSurface())
|
2023-04-16 15:26:52 +02:00
|
|
|
atl[i].draw();
|
|
|
|
}
|
|
|
|
surface_reset_shader();
|
|
|
|
}
|
|
|
|
}
|