Pixel-Composer/scripts/node_attributes/node_attributes.gml

95 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",
"Repeat"
];
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) {
var depth_array = inputs[| 0].type == VALUE_TYPE.surface? global.SURFACE_FORMAT_NAME_PROCESS : global.SURFACE_FORMAT_NAME;
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.interpolation = 0;
2023-10-03 11:27:36 +02:00
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.interpolation; },
new scrollBox(global.SURFACE_INTERPOLATION, function(val) {
attributes.interpolation = val;
triggerRender();
}, false)]);
}
function attribute_oversample(label = false) {
2023-10-03 11:27:36 +02:00
attributes.interpolation = 0;
2023-07-21 12:40:20 +02:00
attributes.oversample = 0;
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