Pixel-Composer/scripts/node_atlas_draw/node_atlas_draw.gml

34 lines
894 B
Text
Raw Normal View History

function Node_Atlas_Draw(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
2023-04-16 15:26:52 +02:00
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
newInput(1, nodeValue_Atlas("Atlas", self))
.setArrayDepth(1)
2023-04-16 15:26:52 +02:00
.setVisible(true, true);
2024-09-04 03:57:11 +02:00
newOutput(0, nodeValue_Output("Surface", self, VALUE_TYPE.surface, noone));
2023-04-16 15:26:52 +02:00
attribute_interpolation(true);
static processData = function(_outSurf, _data, _output_index, _array_index = 0) {
var dim = _data[0];
var atl = _data[1];
2023-04-16 15:26:52 +02:00
//_outSurf = surface_verify(_outSurf, dim[0], dim[1]);
if(!is_array(atl)) atl = [ atl ];
2023-04-16 15:26:52 +02:00
surface_set_shader(_outSurf);
2023-07-25 20:12:40 +02:00
for( var i = 0, n = array_length(atl); i < n; i++ ) {
var _a = atl[i];
if(!is_instanceof(_a, Atlas)) continue;
shader_set_interpolation(_a.getSurface())
_a.draw();
2023-04-16 15:26:52 +02:00
}
surface_reset_shader();
return _outSurf;
2023-04-16 15:26:52 +02:00
}
}