Layer node

This commit is contained in:
luboslenco
2019-11-21 19:57:38 +01:00
parent 367de544f1
commit 7cee89c641
3 changed files with 67 additions and 2 deletions
+45
View File
@@ -799,6 +799,19 @@ class Material {
return 'vVecCam';
}
else if (node.type == 'LAYER') {
if (socket == node.outputs[0]) { // Base
var l = node.buttons[0].default_value;
curshader.add_uniform("sampler2D texpaint", "_texpaint" + l);
return 'texture(texpaint, texCoord).rgb';
}
else if (socket == node.outputs[5]) { // Normal
var l = node.buttons[0].default_value;
curshader.add_uniform("sampler2D texpaint_nor", "_texpaint_nor" + l);
return 'texture(texpaint_nor, texCoord).rgb';
}
}
else if (node.type == 'NEW_GEOMETRY') {
if (socket == node.outputs[0]) { // Position
curshader.wposition = true;
@@ -1129,6 +1142,38 @@ class Material {
}
}
else if (node.type == 'LAYER') {
if (socket == node.outputs[1]) { // Opac
var l = node.buttons[0].default_value;
curshader.add_uniform("sampler2D texpaint", "_texpaint" + l);
return 'texture(texpaint, texCoord).a';
}
else if (socket == node.outputs[2]) { // Occ
var l = node.buttons[0].default_value;
curshader.add_uniform("sampler2D texpaint_pack", "_texpaint_pack" + l);
return 'texture(texpaint_pack, texCoord).r';
}
else if (socket == node.outputs[3]) { // Rough
var l = node.buttons[0].default_value;
curshader.add_uniform("sampler2D texpaint_pack", "_texpaint_pack" + l);
return 'texture(texpaint_pack, texCoord).g';
}
else if (socket == node.outputs[4]) { // Metal
var l = node.buttons[0].default_value;
curshader.add_uniform("sampler2D texpaint_pack", "_texpaint_pack" + l);
return 'texture(texpaint_pack, texCoord).b';
}
// else if (socket == node.outputs[6]) { // Emission
// }
else if (socket == node.outputs[7]) { // Height
var l = node.buttons[0].default_value;
curshader.add_uniform("sampler2D texpaint_pack", "_texpaint_pack" + l);
return 'texture(texpaint_pack, texCoord).a';
}
// else if (socket == node.outputs[8]) { // Subsurface
// }
}
else if (node.type == 'FRESNEL') {
var ior = parse_value_input(node.inputs[0]);
// var nor = parse_vector_input(node.inputs[1])