|
|
|
|
|
|
|
|
|
|
protected int[] validSlots |
|
|
|
{ |
|
|
|
get { return new[] {InputSlotId, OutputSlotId}; } |
|
|
|
get { return new[] { InputSlotId, OutputSlotId }; } |
|
|
|
return new MaterialSlot(InputSlotId, GetInputSlotName(), kInputSlotName, SlotType.Input, SlotValueType.Vector3, Vector3.zero); |
|
|
|
return new Vector3MaterialSlot(InputSlotId, GetInputSlotName(), kInputSlotName, SlotType.Input, Vector3.zero); |
|
|
|
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotName, SlotType.Output, SlotValueType.Vector3, Vector4.zero); |
|
|
|
return new Vector3MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotName, SlotType.Output, Vector4.zero); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetInputSlotName() |
|
|
|
|
|
|
if (requiresTangentTransform) |
|
|
|
visitor.AddShaderChunk("float3x3 tangentTransform = float3x3( worldSpaceTangent, worldSpaceBitangent, worldSpaceNormal);", false); |
|
|
|
|
|
|
|
visitor.AddShaderChunk(precision + outputDimension + " " + GetVariableNameForSlot(OutputSlotId) + " = " + transformString + ";", true); |
|
|
|
visitor.AddShaderChunk(string.Format("{0} {1} = {2};", |
|
|
|
ConvertConcreteSlotValueTypeToString(precision, FindOutputSlot<MaterialSlot>(OutputSlotId).concreteValueType), |
|
|
|
GetVariableNameForSlot(OutputSlotId), |
|
|
|
transformString), true); |
|
|
|
} |
|
|
|
|
|
|
|
//float3x3 tangentTransform = float3x3( i.tangentDir, i.bitangentDir, i.normalDir);------
|
|
|
|
|
|
|
//mul( float4(i.posWorld.rgb,0), UNITY_MATRIX_MV ).xyz - view to local
|
|
|
|
//mul( tangentTransform, mul( float4(i.posWorld.rgb,0), UNITY_MATRIX_V ).xyz ).xyz - view to tangent
|
|
|
|
|
|
|
|
|
|
|
|
public string outputDimension |
|
|
|
{ |
|
|
|
get { return ConvertConcreteSlotValueTypeToString(FindOutputSlot<MaterialSlot>(OutputSlotId).concreteValueType); } |
|
|
|
} |
|
|
|
|
|
|
|
private string inputDimension |
|
|
|
{ |
|
|
|
get { return ConvertConcreteSlotValueTypeToString(FindInputSlot<MaterialSlot>(InputSlotId).concreteValueType); } |
|
|
|
} |
|
|
|
|
|
|
|
return NeededCoordinateSpace.Local; |
|
|
|
return NeededCoordinateSpace.World; |
|
|
|
return NeededCoordinateSpace.Local; |
|
|
|
return NeededCoordinateSpace.World; |
|
|
|
return NeededCoordinateSpace.Local; |
|
|
|
return NeededCoordinateSpace.World; |
|
|
|
} |
|
|
|
} |
|
|
|
} |