private string GetUVCoords(ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, bool isProjecting) { string result = string.Empty; if (m_inputPorts[0].IsConnected) { result = m_inputPorts[0].GenerateShaderForOutput(ref dataCollector, (isProjecting ? WirePortDataType.FLOAT4 : WirePortDataType.FLOAT2), ignoreLocalVar, true); } else { string customScreenPos = null; if (dataCollector.IsTemplate) { customScreenPos = dataCollector.TemplateDataCollectorInstance.GetScreenPos(CurrentPrecisionType); } if (isProjecting) { result = GeneratorUtils.GenerateGrabScreenPosition(ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos, customScreenPos); } else { result = GeneratorUtils.GenerateGrabScreenPositionNormalized(ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos, customScreenPos); } } if (isProjecting && !dataCollector.IsSRP) #if UNITY_5_6_OR_NEWER { return(result); } #else { return("UNITY_PROJ_COORD( " + result + " )"); }
public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar) { if (m_outputPorts[0].IsLocalValue(dataCollector.PortCategory)) { return(GetOutputColorItem(0, outputId, m_outputPorts[0].LocalValue(dataCollector.PortCategory))); } string localVarName = string.Empty; if (m_outputTypeInt == 0) { localVarName = GeneratorUtils.GenerateGrabScreenPositionNormalized(ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos); } else { localVarName = GeneratorUtils.GenerateGrabScreenPosition(ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos); } m_outputPorts[0].SetLocalValue(localVarName, dataCollector.PortCategory); return(GetOutputColorItem(0, outputId, localVarName)); }