76 lines
5.4 KiB
C
76 lines
5.4 KiB
C
|
|
#include "../global.h"
|
|
|
|
char *brightness_contrast_node_vector(ui_node_t *node, ui_node_socket_t *socket) {
|
|
char *out_col = parser_material_parse_vector_input(node->inputs->buffer[0]);
|
|
char *bright = parser_material_parse_value_input(node->inputs->buffer[1], false);
|
|
char *contr = parser_material_parse_value_input(node->inputs->buffer[2], false);
|
|
node_shader_add_function(parser_material_kong, str_brightcontrast);
|
|
return string("brightcontrast(%s, %s, %s)", out_col, bright, contr);
|
|
}
|
|
|
|
void brightness_contrast_node_init() {
|
|
|
|
ui_node_t *brightness_contrast_node_def =
|
|
GC_ALLOC_INIT(ui_node_t, {.id = 0,
|
|
.name = _tr("Brightness/Contrast"),
|
|
.type = "BRIGHTCONTRAST",
|
|
.x = 0,
|
|
.y = 0,
|
|
.color = 0xff448c6d,
|
|
.inputs = any_array_create_from_raw(
|
|
(void *[]){
|
|
GC_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}),
|
|
GC_ALLOC_INIT(ui_node_socket_t, {.id = 0,
|
|
.node_id = 0,
|
|
.name = _tr("Brightness"),
|
|
.type = "VALUE",
|
|
.color = 0xffa1a1a1,
|
|
.default_value = f32_array_create_x(0.0),
|
|
.min = 0.0,
|
|
.max = 1.0,
|
|
.precision = 100,
|
|
.display = 0}),
|
|
GC_ALLOC_INIT(ui_node_socket_t, {.id = 0,
|
|
.node_id = 0,
|
|
.name = _tr("Contrast"),
|
|
.type = "VALUE",
|
|
.color = 0xffa1a1a1,
|
|
.default_value = f32_array_create_x(0.0),
|
|
.min = 0.0,
|
|
.max = 1.0,
|
|
.precision = 100,
|
|
.display = 0}),
|
|
},
|
|
3),
|
|
.outputs = any_array_create_from_raw(
|
|
(void *[]){
|
|
GC_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});
|
|
|
|
any_array_push(nodes_material_color, brightness_contrast_node_def);
|
|
any_map_set(parser_material_node_vectors, "BRIGHTCONTRAST", brightness_contrast_node_vector);
|
|
}
|