Pixel-Composer/scripts/node_attributes/node_attributes.gml

96 lines
2.8 KiB
Text
Raw Normal View History

2023-07-21 12:40:20 +02:00
#region attribute
global.SURFACE_INTERPOLATION = [
2023-07-30 13:56:22 +02:00
"Pixel",
2023-07-21 12:40:20 +02:00
"Bilinear",
"Bicubic",
"radSin"
];
global.SURFACE_OVERSAMPLE = [
"Empty",
"Clamp",
2024-02-15 14:23:26 +01:00
"Repeat",
"Black"
2023-07-21 12:40:20 +02:00
];
function __initSurfaceFormat() {
var surface_format = [
surface_rgba4unorm,
surface_rgba8unorm,
surface_rgba16float,
surface_rgba32float,
surface_r8unorm,
surface_r16float,
surface_r32float
];
var surface_format_name = [
"4 bit RGBA",
"8 bit RGBA",
"16 bit RGBA",
"32 bit RGBA",
"8 bit Greyscale",
"16 bit Greyscale",
"32 bit Greyscale"
];
global.SURFACE_FORMAT = [];
global.SURFACE_FORMAT_NAME = [];
2023-07-25 20:12:40 +02:00
for( var i = 0, n = array_length(surface_format); i < n; i++ ) {
2023-07-21 12:40:20 +02:00
var sup = surface_format_is_supported(surface_format[i]);
array_push(global.SURFACE_FORMAT, surface_format[i]);
array_push(global.SURFACE_FORMAT_NAME, (sup? "" : "-") + surface_format_name[i]);
if(!sup) log_message("WARNING", "Surface format [" + surface_format_name[i] + "] not supported in this device.");
}
global.SURFACE_FORMAT_NAME_PROCESS = [ "Input" ];
global.SURFACE_FORMAT_NAME_PROCESS = array_append(global.SURFACE_FORMAT_NAME_PROCESS, global.SURFACE_FORMAT_NAME);
}
function attribute_surface_depth(label = true) {
2024-08-08 06:57:51 +02:00
var depth_array = inputs[0].type == VALUE_TYPE.surface? global.SURFACE_FORMAT_NAME_PROCESS : global.SURFACE_FORMAT_NAME;
2023-07-21 12:40:20 +02:00
attributes.color_depth = array_find(depth_array, "8 bit RGBA");
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Color depth", function() { return attributes.color_depth; },
new scrollBox(depth_array, function(val) {
attributes.color_depth = val;
triggerRender();
}, false)]);
}
function attribute_interpolation(label = false) {
attributes.interpolate = 0;
attributes.oversample = 0;
2023-07-21 12:40:20 +02:00
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Texture interpolation", function() { return attributes.interpolate; },
2023-07-21 12:40:20 +02:00
new scrollBox(global.SURFACE_INTERPOLATION, function(val) {
attributes.interpolate = val;
2023-07-21 12:40:20 +02:00
triggerRender();
}, false)]);
}
function attribute_oversample(label = false) {
attributes.interpolate = 0;
attributes.oversample = 0;
2023-07-21 12:40:20 +02:00
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Oversample", function() { return attributes.oversample; },
new scrollBox(global.SURFACE_OVERSAMPLE, function(val) {
attributes.oversample = val;
triggerRender();
}, false)]);
}
function attribute_auto_execute(label = false) {
attributes.auto_exe = false;
if(label) array_push(attributeEditors, "Node");
array_push(attributeEditors, ["Auto execute", function() { return attributes.auto_exe; },
new checkBox(function() {
attributes.auto_exe = !attributes.auto_exe;
})]);
}
#endregion