2023-07-21 12:40:20 +02:00
|
|
|
#region attribute
|
|
|
|
global.SURFACE_INTERPOLATION = [
|
2024-10-17 04:46:19 +02:00
|
|
|
"-Group",
|
2023-07-30 13:56:22 +02:00
|
|
|
"Pixel",
|
2023-07-21 12:40:20 +02:00
|
|
|
"Bilinear",
|
|
|
|
"Bicubic",
|
|
|
|
"radSin"
|
|
|
|
];
|
|
|
|
|
|
|
|
global.SURFACE_OVERSAMPLE = [
|
2024-10-17 04:46:19 +02:00
|
|
|
"-Group",
|
2023-07-21 12:40:20 +02:00
|
|
|
"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 = [
|
2024-10-17 04:46:19 +02:00
|
|
|
-1,
|
|
|
|
-2,
|
2023-07-21 12:40:20 +02:00
|
|
|
surface_rgba4unorm,
|
|
|
|
surface_rgba8unorm,
|
|
|
|
surface_rgba16float,
|
|
|
|
surface_rgba32float,
|
|
|
|
surface_r8unorm,
|
|
|
|
surface_r16float,
|
|
|
|
surface_r32float
|
|
|
|
];
|
|
|
|
|
|
|
|
var surface_format_name = [
|
2024-10-17 04:46:19 +02:00
|
|
|
"-Input",
|
|
|
|
"-Group",
|
2023-07-21 12:40:20 +02:00
|
|
|
"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++ ) {
|
2024-10-17 04:46:19 +02:00
|
|
|
var _form = surface_format[i];
|
|
|
|
var _supp = _form < 0 || surface_format_is_supported(_form);
|
2023-07-21 12:40:20 +02:00
|
|
|
|
2024-10-17 04:46:19 +02:00
|
|
|
array_push(global.SURFACE_FORMAT, _form);
|
|
|
|
array_push(global.SURFACE_FORMAT_NAME, (_supp? "" : "-") + surface_format_name[i]);
|
|
|
|
|
|
|
|
if(!_supp) log_message("WARNING", $"Surface format [{surface_format_name[i]}] not supported in this device.");
|
2023-07-21 12:40:20 +02:00
|
|
|
}
|
2024-10-17 04:46:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function __attribute_set(node, key, value) {
|
|
|
|
node.attributes[$ key] = value;
|
|
|
|
node.triggerRender();
|
|
|
|
}
|
|
|
|
|
|
|
|
function attribute_set(key, value) {
|
|
|
|
if(PANEL_INSPECTOR == noone) return;
|
|
|
|
|
|
|
|
if(PANEL_INSPECTOR.inspecting)
|
|
|
|
__attribute_set(PANEL_INSPECTOR.inspecting, key, value);
|
2023-07-21 12:40:20 +02:00
|
|
|
|
2024-10-17 04:46:19 +02:00
|
|
|
if(PANEL_INSPECTOR.inspectGroup == 1)
|
|
|
|
for( var i = 0, n = array_length(PANEL_INSPECTOR.inspectings); i < n; i++ )
|
|
|
|
__attribute_set(PANEL_INSPECTOR.inspectings[i], key, value);
|
2023-07-21 12:40:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function attribute_surface_depth(label = true) {
|
2024-10-17 04:46:19 +02:00
|
|
|
attr_depth_array = global.SURFACE_FORMAT_NAME;
|
|
|
|
if(!array_empty(inputs) && inputs[0].type == VALUE_TYPE.surface)
|
|
|
|
attr_depth_array[0] = "Input";
|
|
|
|
|
|
|
|
attributes.color_depth = 3;
|
2023-07-21 12:40:20 +02:00
|
|
|
|
|
|
|
if(label) array_push(attributeEditors, "Surface");
|
2024-10-17 04:46:19 +02:00
|
|
|
array_push(attributeEditors, ["Color depth", function() /*=>*/ {return attributes.color_depth},
|
|
|
|
new scrollBox(attr_depth_array, function(val) /*=>*/ { attribute_set("color_depth", val); }, false), "color_depth"]);
|
2023-07-21 12:40:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function attribute_interpolation(label = false) {
|
2024-10-17 04:46:19 +02:00
|
|
|
attributes.interpolate = 1;
|
|
|
|
attributes.oversample = 1;
|
2023-07-21 12:40:20 +02:00
|
|
|
|
|
|
|
if(label) array_push(attributeEditors, "Surface");
|
2024-10-17 04:46:19 +02:00
|
|
|
array_push(attributeEditors, ["Texture interpolation", function() /*=>*/ {return attributes.interpolate},
|
|
|
|
new scrollBox(global.SURFACE_INTERPOLATION, function(val) /*=>*/ { attribute_set("interpolate", val); }, false), "interpolate"]);
|
2023-07-21 12:40:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function attribute_oversample(label = false) {
|
2024-10-17 04:46:19 +02:00
|
|
|
attributes.interpolate = 1;
|
|
|
|
attributes.oversample = 1;
|
2023-07-21 12:40:20 +02:00
|
|
|
|
|
|
|
if(label) array_push(attributeEditors, "Surface");
|
2024-10-17 04:46:19 +02:00
|
|
|
array_push(attributeEditors, ["Oversample", function() /*=>*/ {return attributes.oversample},
|
|
|
|
new scrollBox(global.SURFACE_OVERSAMPLE, function(val) /*=>*/ { attribute_set("oversample", val); }, false), "oversample"]);
|
2023-07-21 12:40:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function attribute_auto_execute(label = false) {
|
|
|
|
attributes.auto_exe = false;
|
2024-10-17 04:46:19 +02:00
|
|
|
|
2023-07-21 12:40:20 +02:00
|
|
|
if(label) array_push(attributeEditors, "Node");
|
2024-10-17 04:46:19 +02:00
|
|
|
array_push(attributeEditors, ["Auto execute", function() /*=>*/ {return attributes.auto_exe},
|
|
|
|
new checkBox(function() /*=>*/ { attribute_set("auto_exe", !attributes.auto_exe); })]);
|
2023-07-21 12:40:20 +02:00
|
|
|
}
|
|
|
|
#endregion
|