Add picker material node
This commit is contained in:
@@ -786,6 +786,16 @@ class MaterialParser {
|
||||
parents.pop();
|
||||
return result;
|
||||
}
|
||||
else if (node.type == "PICKER") {
|
||||
if (socket == node.outputs[0]) { // Base
|
||||
curshader.add_uniform("vec3 pickerBase", "_pickerBase");
|
||||
return "pickerBase";
|
||||
}
|
||||
else if (socket == node.outputs[5]) { // Normal
|
||||
curshader.add_uniform("vec3 pickerNormal", "_pickerNormal");
|
||||
return "pickerNormal";
|
||||
}
|
||||
}
|
||||
else if (node.type == "NEW_GEOMETRY") {
|
||||
if (socket == node.outputs[0]) { // Position
|
||||
curshader.wposition = true;
|
||||
@@ -1129,6 +1139,28 @@ class MaterialParser {
|
||||
parents.pop();
|
||||
return result;
|
||||
}
|
||||
else if (node.type == "PICKER") {
|
||||
if (socket == node.outputs[1]) {
|
||||
curshader.add_uniform("float pickerOpacity", "_pickerOpacity");
|
||||
return "pickerOpacity";
|
||||
}
|
||||
else if (socket == node.outputs[2]) {
|
||||
curshader.add_uniform("float pickerOcclusion", "_pickerOcclusion");
|
||||
return "pickerOcclusion";
|
||||
}
|
||||
else if (socket == node.outputs[3]) {
|
||||
curshader.add_uniform("float pickerRoughness", "_pickerRoughness");
|
||||
return "pickerRoughness";
|
||||
}
|
||||
else if (socket == node.outputs[4]) {
|
||||
curshader.add_uniform("float pickerMetallic", "_pickerMetallic");
|
||||
return "pickerMetallic";
|
||||
}
|
||||
else if (socket == node.outputs[7]) {
|
||||
curshader.add_uniform("float pickerHeight", "_pickerHeight");
|
||||
return "pickerHeight";
|
||||
}
|
||||
}
|
||||
else if (node.type == "FRESNEL") {
|
||||
var ior = parse_value_input(node.inputs[0]);
|
||||
curshader.dotNV = true;
|
||||
|
||||
@@ -506,6 +506,90 @@ class NodesMaterial {
|
||||
],
|
||||
buttons: []
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
name: _tr("Picker"),
|
||||
type: "PICKER", // extension
|
||||
x: 0,
|
||||
y: 0,
|
||||
color: 0xff4982a0,
|
||||
inputs: [],
|
||||
outputs: [
|
||||
{
|
||||
id: 0,
|
||||
node_id: 0,
|
||||
name: _tr("Base Color"),
|
||||
type: "RGBA",
|
||||
color: 0xffc7c729,
|
||||
default_value: f32([0.0, 0.0, 0.0, 1.0])
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
node_id: 0,
|
||||
name: _tr("Opacity"),
|
||||
type: "VALUE",
|
||||
color: 0xffa1a1a1,
|
||||
default_value: 1.0
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
node_id: 0,
|
||||
name: _tr("Occlusion"),
|
||||
type: "VALUE",
|
||||
color: 0xffa1a1a1,
|
||||
default_value: 1.0
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
node_id: 0,
|
||||
name: _tr("Roughness"),
|
||||
type: "VALUE",
|
||||
color: 0xffa1a1a1,
|
||||
default_value: 1.0
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
node_id: 0,
|
||||
name: _tr("Metallic"),
|
||||
type: "VALUE",
|
||||
color: 0xffa1a1a1,
|
||||
default_value: 1.0
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
node_id: 0,
|
||||
name: _tr("Normal Map"),
|
||||
type: "VECTOR",
|
||||
color: -10238109,
|
||||
default_value: f32([0.5, 0.5, 1.0])
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
node_id: 0,
|
||||
name: _tr("Emission"),
|
||||
type: "VALUE",
|
||||
color: 0xffa1a1a1,
|
||||
default_value: 1.0
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
node_id: 0,
|
||||
name: _tr("Height"),
|
||||
type: "VALUE",
|
||||
color: 0xffa1a1a1,
|
||||
default_value: 1.0
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
node_id: 0,
|
||||
name: _tr("Subsurface"),
|
||||
type: "VALUE",
|
||||
color: 0xffa1a1a1,
|
||||
default_value: 1.0
|
||||
}
|
||||
],
|
||||
buttons: []
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
name: _tr("RGB"),
|
||||
|
||||
@@ -67,9 +67,11 @@ class Context {
|
||||
public static var normalRPicked = 0.0;
|
||||
public static var normalGPicked = 0.0;
|
||||
public static var normalBPicked = 0.0;
|
||||
public static var opacityPicked = 0.0;
|
||||
public static var roughnessPicked = 0.0;
|
||||
public static var metallicPicked = 0.0;
|
||||
public static var occlusionPicked = 0.0;
|
||||
public static var heightPicked = 0.0;
|
||||
public static var materialIdPicked = 0;
|
||||
public static var uvxPicked = 0.0;
|
||||
public static var uvyPicked = 0.0;
|
||||
|
||||
@@ -100,6 +100,21 @@ class Uniforms {
|
||||
case "_decalLayerDim": {
|
||||
return Context.layer.decalMat.getScale().z * 0.5;
|
||||
}
|
||||
case "_pickerOpacity": {
|
||||
return Context.opacityPicked;
|
||||
}
|
||||
case "_pickerOcclusion": {
|
||||
return Context.occlusionPicked;
|
||||
}
|
||||
case "_pickerRoughness": {
|
||||
return Context.roughnessPicked;
|
||||
}
|
||||
case "_pickerMetallic": {
|
||||
return Context.metallicPicked;
|
||||
}
|
||||
case "_pickerHeight": {
|
||||
return Context.heightPicked;
|
||||
}
|
||||
}
|
||||
if (MaterialParser.script_links != null) {
|
||||
for (key in MaterialParser.script_links.keys()) {
|
||||
@@ -181,6 +196,16 @@ class Uniforms {
|
||||
v.set(Context.layer.decalMat._20, Context.layer.decalMat._21, Context.layer.decalMat._22).normalize();
|
||||
return v;
|
||||
}
|
||||
case "_pickerBase": {
|
||||
v = iron.object.Uniforms.helpVec;
|
||||
v.set(Context.baseRPicked, Context.baseGPicked, Context.baseBPicked);
|
||||
return v;
|
||||
}
|
||||
case "_pickerNormal": {
|
||||
v = iron.object.Uniforms.helpVec;
|
||||
v.set(Context.normalRPicked, Context.normalGPicked, Context.normalBPicked);
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
|
||||
Reference in New Issue
Block a user