Fix compile

This commit is contained in:
luboslenco
2025-10-06 17:45:58 +02:00
parent 3691ac515a
commit 767408907f
14 changed files with 26 additions and 31 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ function clamp_node_value(node: ui_node_t, socket: ui_node_socket_t): string {
if (op == "MIN_MAX") {
return "(clamp(" + val + ", " + min + ", " + max + "))";
}
else if (op == "RANGE") {
else { // RANGE
return "(clamp(" + val + ", min(" + min + ", " + max + "), max(" + min + ", " + max + ")))";
}
}
@@ -20,7 +20,7 @@ function geometry_node_vector(node: ui_node_t, socket: ui_node_socket_t): string
parser_material_kong.frag_vvec = true;
return "vvec";
}
else if (socket == node.outputs[5]) { // Parametric
else { // Parametric
parser_material_kong.frag_mposition = true;
return "input.mposition";
}
@@ -43,7 +43,7 @@ function geometry_node_value(node: ui_node_t, socket: ui_node_socket_t): string
parser_material_write(parser_material_kong, store + "_curvature = clamp(pow(" + store + "_curvature, (1.0 / " + radius + ") * 0.25) * " + strength + " * 2.0 + " + offset + " / 10.0, 0.0, 1.0);");
return store + "_curvature";
}
else if (socket == node.outputs[8]) { // Random Per Island
else { // Random Per Island
return "0.0";
}
}
@@ -1,10 +1,8 @@
function layer_mask_node_value(node: ui_node_t, socket: ui_node_socket_t): string {
if (socket == node.outputs[0]) {
let l: i32 = node.buttons[0].default_value[0];
node_shader_add_texture(parser_material_kong, "texpaint" + l, "_texpaint" + l);
return "sample(texpaint" + l + ", sampler_linear, tex_coord).r";
}
let l: i32 = node.buttons[0].default_value[0];
node_shader_add_texture(parser_material_kong, "texpaint" + l, "_texpaint" + l);
return "sample(texpaint" + l + ", sampler_linear, tex_coord).r";
}
let layer_mask_node_def: ui_node_t = {
+3 -1
View File
@@ -5,7 +5,7 @@ function layer_node_vector(node: ui_node_t, socket: ui_node_socket_t): string {
node_shader_add_texture(parser_material_kong, "texpaint" + l, "_texpaint" + l);
return "sample(texpaint" + l + ", sampler_linear, tex_coord).rgb";
}
else if (socket == node.outputs[5]) { // Normal
else { // Normal
node_shader_add_texture(parser_material_kong, "texpaint_nor" + l, "_texpaint_nor" + l);
return "sample(texpaint_nor" + l + ", sampler_linear, tex_coord).rgb";
}
@@ -29,10 +29,12 @@ function layer_node_value(node: ui_node_t, socket: ui_node_socket_t): string {
node_shader_add_texture(parser_material_kong, "texpaint_pack" + l, "_texpaint_pack" + l);
return "sample(texpaint_pack" + l + ", sampler_linear, tex_coord).b";
}
else if (socket == node.outputs[6]) { return "0.0"; } // Emission
else if (socket == node.outputs[7]) { // Height
node_shader_add_texture(parser_material_kong, "texpaint_pack" + l, "_texpaint_pack" + l);
return "sample(texpaint_pack" + l + ", sampler_linear, tex_coord).a";
}
else { return "0.0"; } // Subsurface
}
let layer_node_def: ui_node_t = {
@@ -5,7 +5,7 @@ function layer_weight_node_value(node: ui_node_t, socket: ui_node_socket_t): str
parser_material_kong.frag_dotnv = true;
return "clamp(pow(1.0 - dotnv, (1.0 - " + blend + ") * 10.0), 0.0, 1.0)";
}
else if (socket == node.outputs[1]) { // Facing
else { // Facing
parser_material_kong.frag_dotnv = true;
return "((1.0 - dotnv) * " + blend + ")";
}
@@ -9,17 +9,17 @@ function mix_normal_map_node_vector(node: ui_node_t, socket: ui_node_socket_t):
// The blending algorithms are based on the paper "Blending in Detail" by Colin Barré-Brisebois and Stephen Hill 2012
// https://blog.selfshadow.com/publications/blending-in-detail/
if (blend == "PARTIAL_DERIVATIVE") { //partial derivate blending
if (blend == "PARTIAL_DERIVATIVE") { // partial derivate blending
parser_material_write(parser_material_kong, "var " + store + "_n1: float3 = " + nm1 + " * 2.0 - 1.0;");
parser_material_write(parser_material_kong, "var " + store + "_n2: float3 = " + nm2 + " * 2.0 - 1.0;");
return "0.5 * normalize(float3(" + store + "_n1.xy * " + store + "_n2.z + " + store + "_n2.xy * " + store + "_n1.z, " + store + "_n1.z * " + store + "_n2.z)) + 0.5";
}
else if (blend == "WHITEOUT") { //whiteout blending
else if (blend == "WHITEOUT") { // whiteout blending
parser_material_write(parser_material_kong, "var " + store + "_n1: float3 = " + nm1 + " * 2.0 - 1.0;");
parser_material_write(parser_material_kong, "var " + store + "_n2: float3 = " + nm2 + " * 2.0 - 1.0;");
return "0.5 * normalize(float3(" + store + "_n1.xy + " + store + "_n2.xy, " + store + "_n1.z * " + store + "_n2.z)) + 0.5";
}
else if (blend == "REORIENTED") { //reoriented normal mapping
else { // rREORIENTED - eoriented normal mapping
parser_material_write(parser_material_kong, "var " + store + "_n1: float3 = " + nm1 + " * 2.0 - float3(1.0, 1.0, 0.0);");
parser_material_write(parser_material_kong, "var " + store + "_n2: float3 = " + nm2 + " * float3(-2.0, -2.0, 2.0) - float3(-1.0, -1.0, 1.0);");
return "0.5 * normalize(" + store + "_n1 * dot(" + store + "_n1, " + store + "_n2) - " + store + "_n2 * " + store + "_n1.z) + 0.5";
+1 -8
View File
@@ -1,13 +1,6 @@
function normal_node_vector(node: ui_node_t, socket: ui_node_socket_t): string {
if (socket == node.outputs[0]) {
return parser_material_vec3(node.outputs[0].default_value);
}
else if (socket == node.outputs[1]) {
let nor: string = parser_material_parse_vector_input(node.inputs[0]);
let norout: string = parser_material_vec3(node.outputs[0].default_value);
return parser_material_to_vec3("dot(" + norout + ", " + nor + ")");
}
return parser_material_vec3(node.outputs[0].default_value);
}
function normal_node_value(node: ui_node_t, socket: ui_node_socket_t): string {
@@ -4,21 +4,21 @@ function object_info_node_vector(node: ui_node_t, socket: ui_node_socket_t): str
parser_material_kong.frag_wposition = true;
return "input.wposition";
}
else if (socket == node.outputs[1]) { // Color
else { // Color
return "float3(0.0, 0.0, 0.0)";
}
}
function object_info_node_value(node: ui_node_t, socket: ui_node_socket_t): string {
if (socket == node.outputs[1]) { // Object Index
if (socket == node.outputs[2]) { // Object Index
node_shader_add_constant(parser_material_kong, "object_info_index: float", "_object_info_index");
return "constants.object_info_index";
}
else if (socket == node.outputs[2]) { // Material Index
else if (socket == node.outputs[3]) { // Material Index
node_shader_add_constant(parser_material_kong, "object_info_material_index: float", "_object_info_material_index");
return "constants.object_info_material_index";
}
else if (socket == node.outputs[3]) { // Random
else { // Random
node_shader_add_constant(parser_material_kong, "object_info_random: float", "_object_info_random");
return "constants.object_info_random";
}
+3 -1
View File
@@ -4,7 +4,7 @@ function picker_node_vector(node: ui_node_t, socket: ui_node_socket_t): string {
node_shader_add_constant(parser_material_kong, "picker_base: float3", "_picker_base");
return "constants.picker_base";
}
else if (socket == node.outputs[5]) { // Normal
else { // Normal
node_shader_add_constant(parser_material_kong, "picker_normal: float3", "_picker_normal");
return "constants.picker_normal";
}
@@ -27,10 +27,12 @@ function picker_node_value(node: ui_node_t, socket: ui_node_socket_t): string {
node_shader_add_constant(parser_material_kong, "picker_metallic: float", "_picker_metallic");
return "constants.picker_metallic";
}
else if (socket == node.outputs[6]) { return "0.0"; } // Emission
else if (socket == node.outputs[7]) {
node_shader_add_constant(parser_material_kong, "picker_height: float", "_picker_height");
return "constants.picker_height";
}
else { return "0.0"; } // Subsurface
}
let picker_node_def: ui_node_t = {
@@ -8,7 +8,7 @@ function separate_hsv_node_value(node: ui_node_t, socket: ui_node_socket_t): str
else if (socket == node.outputs[1]) {
return "rgb_to_hsv(" + col + ").g";
}
else if (socket == node.outputs[2]) {
else { // V
return "rgb_to_hsv(" + col + ").b";
}
}
@@ -7,7 +7,7 @@ function separate_rgb_node_value(node: ui_node_t, socket: ui_node_socket_t): str
else if (socket == node.outputs[1]) {
return col + ".g";
}
else if (socket == node.outputs[2]) {
else {
return col + ".b";
}
}
@@ -7,7 +7,7 @@ function separate_xyz_node_value(node: ui_node_t, socket: ui_node_socket_t): str
else if (socket == node.outputs[1]) {
return vec + ".y";
}
else if (socket == node.outputs[2]) {
else {
return vec + ".z";
}
}
@@ -24,7 +24,7 @@ function texture_coordinate_node_vector(node: ui_node_t, socket: ui_node_socket_
parser_material_kong.frag_wvpposition = true;
return "input.wvpposition.xyz";
}
else if (socket == node.outputs[6]) { // Reflection
else { // Reflection
return "float3(0.0, 0.0, 0.0)";
}
}
@@ -79,7 +79,7 @@ function vector_math2_node_vector(node: ui_node_t, socket: ui_node_socket_t): st
else if (op == "COSINE") {
return "float3(cos(" + vec1 + ".x), cos(" + vec1 + ".y), cos(" + vec1 + ".z))";
}
else if (op == "TANGENT") {
else { // TANGENT
return "float3(tan(" + vec1 + ".x), tan(" + vec1 + ".y), tan(" + vec1 + ".z))";
}
}