Пример #1
0
        public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar)
        {
            dataCollector.AddToIncludes(UniqueId, Constants.UnityCgLibFuncs);
            dataCollector.AddToInput(UniqueId, UIUtils.GetInputDeclarationFromType(m_currentPrecisionType, AvailableSurfaceInputs.WORLD_POS), true);

            string vertexPos = GeneratorUtils.GenerateVertexPosition(ref dataCollector, UniqueId, m_currentPrecisionType, WirePortDataType.FLOAT4);

            return(GeneratorUtils.GenerateObjectLightDirection(ref dataCollector, UniqueId, m_currentPrecisionType, vertexPos));
        }
Пример #2
0
        public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar)
        {
            if (dataCollector.MasterNodeCategory == AvailableShaderTypes.Template)
            {
                string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition((m_sizeOption == 0) ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4);
                return(GetOutputVectorItem(0, outputId, vertexPos));
            }


            if (dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug)
            {
                base.GenerateShaderForOutput(outputId, ref dataCollector, ignoreLocalVar);
            }

            WirePortDataType sizeType = m_sizeOption == 0 ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4;

            string vertexPosition = GeneratorUtils.GenerateVertexPosition(ref dataCollector, UniqueId, m_currentPrecisionType, sizeType);

            return(GetOutputVectorItem(0, outputId, vertexPosition));

            //if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
            //{
            //	string vertexVar = base.GenerateShaderForOutput( 0, ref dataCollector, ignoreLocalVar );
            //	if ( outputId != 0 )
            //	{
            //		return GetOutputVectorItem( 0, outputId, vertexVar );
            //	}
            //	else if ( m_sizeOption == 0 )
            //	{
            //		vertexVar += ".xyz";
            //	}

            //	return vertexVar;
            //}
            //else
            //{

            //	string vertexVar = GeneratorUtils.GenerateVertexPositionOnFrag( ref dataCollector, UniqueId, m_currentPrecisionType );
            //	if ( outputId != 0 )
            //	{
            //		return GetOutputVectorItem( 0, outputId, vertexVar );
            //	}
            //	else if ( m_sizeOption == 0 )
            //	{
            //		vertexVar += ".xyz";
            //	}
            //	return GetOutputVectorItem( 0, outputId, vertexVar );
            //}
        }
Пример #3
0
        public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar)
        {
            if (dataCollector.IsTemplate)
            {
                //Template must have its Light Mode correctly configured on tags to work as intended
                return(dataCollector.TemplateDataCollectorInstance.GetObjectSpaceLightDir());
            }

            dataCollector.AddToIncludes(UniqueId, Constants.UnityCgLibFuncs);
            dataCollector.AddToInput(UniqueId, UIUtils.GetInputDeclarationFromType(PrecisionType.Float, AvailableSurfaceInputs.WORLD_POS), true);

            string vertexPos = GeneratorUtils.GenerateVertexPosition(ref dataCollector, UniqueId, WirePortDataType.FLOAT4);

            return(GeneratorUtils.GenerateObjectLightDirection(ref dataCollector, UniqueId, m_currentPrecisionType, vertexPos));
        }