2026-03-09 13:17:15 +01:00
|
|
|
|
|
|
|
|
#include "../global.h"
|
|
|
|
|
|
2026-04-04 21:38:20 +02:00
|
|
|
char *hue_saturation_value_node_vector(ui_node_t *node, ui_node_socket_t *socket) {
|
|
|
|
|
node_shader_add_function(parser_material_kong, str_hue_sat);
|
|
|
|
|
char *hue = parser_material_parse_value_input(node->inputs->buffer[0], false);
|
|
|
|
|
char *sat = parser_material_parse_value_input(node->inputs->buffer[1], false);
|
|
|
|
|
char *val = parser_material_parse_value_input(node->inputs->buffer[2], false);
|
|
|
|
|
char *fac = parser_material_parse_value_input(node->inputs->buffer[3], false);
|
|
|
|
|
char *col = parser_material_parse_vector_input(node->inputs->buffer[4]);
|
2026-08-21 22:35:41 +02:00
|
|
|
return string_tmp("hue_sat(%s, float4(%s - 0.5, %s, %s, 1.0 - %s))", col, hue, sat, val, fac);
|
2026-04-04 21:38:20 +02:00
|
|
|
}
|
|
|
|
|
|
2026-03-06 12:56:38 +01:00
|
|
|
void hue_saturation_value_node_init() {
|
2026-03-31 18:47:10 +02:00
|
|
|
|
2026-04-05 16:09:00 +02:00
|
|
|
ui_node_t *hue_saturation_value_node_def =
|
2026-08-21 22:35:41 +02:00
|
|
|
ALLOC_INIT(ui_node_t, {.id = 0,
|
2026-08-21 22:40:25 +02:00
|
|
|
.name = _tr("Hue/Saturation/Value"),
|
|
|
|
|
.type = "HUE_SAT",
|
|
|
|
|
.x = 0,
|
|
|
|
|
.y = 0,
|
|
|
|
|
.color = 0xff448c6d,
|
|
|
|
|
.inputs = any_array_create_from_raw(
|
|
|
|
|
(void *[]){
|
|
|
|
|
ALLOC_INIT(ui_node_socket_t, {.id = 0,
|
|
|
|
|
.node_id = 0,
|
|
|
|
|
.name = _tr("Hue"),
|
|
|
|
|
.type = "VALUE",
|
|
|
|
|
.color = 0xffa1a1a1,
|
|
|
|
|
.default_value = f32_array_create_x(0.5),
|
|
|
|
|
.min = 0.0,
|
|
|
|
|
.max = 1.0,
|
|
|
|
|
.precision = 100,
|
|
|
|
|
.display = 0}),
|
|
|
|
|
ALLOC_INIT(ui_node_socket_t, {.id = 0,
|
|
|
|
|
.node_id = 0,
|
|
|
|
|
.name = _tr("Saturation"),
|
|
|
|
|
.type = "VALUE",
|
|
|
|
|
.color = 0xffa1a1a1,
|
|
|
|
|
.default_value = f32_array_create_x(1.0),
|
|
|
|
|
.min = 0.0,
|
|
|
|
|
.max = 1.0,
|
|
|
|
|
.precision = 100,
|
|
|
|
|
.display = 0}),
|
|
|
|
|
ALLOC_INIT(ui_node_socket_t, {.id = 0,
|
|
|
|
|
.node_id = 0,
|
|
|
|
|
.name = _tr("Value"),
|
|
|
|
|
.type = "VALUE",
|
|
|
|
|
.color = 0xffa1a1a1,
|
|
|
|
|
.default_value = f32_array_create_x(1.0),
|
|
|
|
|
.min = 0.0,
|
|
|
|
|
.max = 1.0,
|
|
|
|
|
.precision = 100,
|
|
|
|
|
.display = 0}),
|
|
|
|
|
ALLOC_INIT(ui_node_socket_t, {.id = 0,
|
|
|
|
|
.node_id = 0,
|
|
|
|
|
.name = _tr("Factor"),
|
|
|
|
|
.type = "VALUE",
|
|
|
|
|
.color = 0xffa1a1a1,
|
|
|
|
|
.default_value = f32_array_create_x(1.0),
|
|
|
|
|
.min = 0.0,
|
|
|
|
|
.max = 1.0,
|
|
|
|
|
.precision = 100,
|
|
|
|
|
.display = 0}),
|
|
|
|
|
ALLOC_INIT(ui_node_socket_t, {.id = 0,
|
|
|
|
|
.node_id = 0,
|
|
|
|
|
.name = _tr("Color"),
|
|
|
|
|
.type = "RGBA",
|
|
|
|
|
.color = 0xffc7c729,
|
|
|
|
|
.default_value = f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
|
|
|
|
|
.min = 0.0,
|
|
|
|
|
.max = 1.0,
|
|
|
|
|
.precision = 100,
|
|
|
|
|
.display = 0}),
|
|
|
|
|
},
|
|
|
|
|
5),
|
|
|
|
|
.outputs = any_array_create_from_raw(
|
|
|
|
|
(void *[]){
|
|
|
|
|
ALLOC_INIT(ui_node_socket_t, {.id = 0,
|
|
|
|
|
.node_id = 0,
|
|
|
|
|
.name = _tr("Color"),
|
|
|
|
|
.type = "RGBA",
|
|
|
|
|
.color = 0xffc7c729,
|
|
|
|
|
.default_value = f32_array_create_xyzw(0.8, 0.8, 0.8, 1.0),
|
|
|
|
|
.min = 0.0,
|
|
|
|
|
.max = 1.0,
|
|
|
|
|
.precision = 100,
|
|
|
|
|
.display = 0}),
|
|
|
|
|
},
|
|
|
|
|
1),
|
|
|
|
|
.buttons = any_array_create_from_raw((void *[]){}, 0),
|
|
|
|
|
.width = 0,
|
|
|
|
|
.flags = 0});
|
2026-03-31 18:47:10 +02:00
|
|
|
|
2026-03-06 12:56:38 +01:00
|
|
|
any_array_push(nodes_material_color, hue_saturation_value_node_def);
|
|
|
|
|
any_map_set(parser_material_node_vectors, "HUE_SAT", hue_saturation_value_node_vector);
|
|
|
|
|
}
|