|
|
|
|
|
|
var result = string.Format("{0} {1} = {2};" |
|
|
|
, precision |
|
|
|
, GetVariableNameForSlot(OutputSlotId) |
|
|
|
, property.name); |
|
|
|
, property.referenceName); |
|
|
|
visitor.AddShaderChunk(result, true); |
|
|
|
} |
|
|
|
else if (property is Vector2ShaderProperty) |
|
|
|
|
|
|
, GetVariableNameForSlot(OutputSlotId) |
|
|
|
, property.name); |
|
|
|
, property.referenceName); |
|
|
|
visitor.AddShaderChunk(result, true); |
|
|
|
} |
|
|
|
else if (property is Vector3ShaderProperty) |
|
|
|
|
|
|
, GetVariableNameForSlot(OutputSlotId) |
|
|
|
, property.name); |
|
|
|
, property.referenceName); |
|
|
|
visitor.AddShaderChunk(result, true); |
|
|
|
} |
|
|
|
else if (property is Vector4ShaderProperty) |
|
|
|
|
|
|
, GetVariableNameForSlot(OutputSlotId) |
|
|
|
, property.name); |
|
|
|
, property.referenceName); |
|
|
|
visitor.AddShaderChunk(result, true); |
|
|
|
} |
|
|
|
else if (property is ColorShaderProperty) |
|
|
|
|
|
|
, GetVariableNameForSlot(OutputSlotId) |
|
|
|
, property.name); |
|
|
|
, property.referenceName); |
|
|
|
visitor.AddShaderChunk(result, true); |
|
|
|
} |
|
|
|
else if (property is TextureShaderProperty) |
|
|
|
|
|
|
var result = string.Format("{0}4 {1} = UNITY_SAMPLE_TEX2D({2},{3});" |
|
|
|
, precision |
|
|
|
, GetVariableNameForSlot(OutputSlotId) |
|
|
|
, property.name |
|
|
|
, property.referenceName |
|
|
|
, uvName); |
|
|
|
visitor.AddShaderChunk(result, true); |
|
|
|
visitor.AddShaderChunk(string.Format("{0} {1} = {2}.r;", precision, GetVariableNameForSlot(ROutputSlotId), GetVariableNameForSlot(OutputSlotId)), true); |
|
|
|
|
|
|
|
|
|
|
var graph = owner as AbstractMaterialGraph; |
|
|
|
var property = graph.properties.FirstOrDefault(x => x.guid == propertyGuid); |
|
|
|
return property.name; |
|
|
|
return property.referenceName; |
|
|
|
} |
|
|
|
|
|
|
|
protected override bool CalculateNodeHasError() |
|
|
|