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;
|
|
|
|
|
2023-07-21 12:40:20 +02:00
|
|
|
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
|
2023-04-16 15:26:52 +02:00
|
|
|
.setDisplay(VALUE_DISPLAY.vector);
|
|
|
|
|
|
|
|
inputs[| 1] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.atlas, noone)
|
|
|
|
.setVisible(true, true);
|
|
|
|
|
|
|
|
outputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
|
|
|
|
|
|
|
attribute_interpolation(true);
|
|
|
|
|
2023-07-06 19:49:16 +02:00
|
|
|
static update = function(frame = PROJECT.animator.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 ];
|
|
|
|
|
|
|
|
var outSurf = outputs[| 0].getValue();
|
|
|
|
outSurf = surface_verify(outSurf, dim[0], dim[1]);
|
|
|
|
outputs[| 0].setValue(outSurf);
|
|
|
|
|
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-04-16 15:26:52 +02:00
|
|
|
shader_set_interpolation(atl[i].surface.get())
|
|
|
|
atl[i].draw();
|
|
|
|
}
|
|
|
|
surface_reset_shader();
|
|
|
|
}
|
|
|
|
}
|