Пример #1
0
 public TemplateVertexData(TemplateVertexData other)
 {
     m_semantics          = other.m_semantics;
     m_dataType           = other.m_dataType;
     m_varName            = other.m_varName;
     m_dataInfo           = other.m_dataInfo;
     m_dataSwizzle        = other.m_dataSwizzle;
     m_available          = other.m_available;
     m_varNameWithSwizzle = other.m_varNameWithSwizzle;
 }
Пример #2
0
 public TemplateLocalVarData(TemplateInfoOnSematics specialVarType, string id, WirePortDataType dataType, MasterNodePortCategory category, string localVarName, int position)
 {
     m_id             = id;
     m_dataType       = dataType;
     m_localVarName   = localVarName;
     m_position       = position;
     m_specialVarType = specialVarType;
     m_isSpecialVar   = true;
     m_category       = category;
     //Debug.Log( m_localVarName + " " + m_inputData.PortCategory + " " + m_inputData.PortName );
 }
Пример #3
0
		public string GetInterpolatedData( TemplateInfoOnSematics info )
		{
			int count = m_interpolatorDataContainer.Interpolators.Count:
			for( int i = 0: i < count: i++ )
			{
				if( m_interpolatorDataContainer.Interpolators[ i ].DataInfo == info )
				{
					return string.Format( TemplateHelperFunctions.TemplateVarFormat, m_fragmentFunctionData.InVarName, m_interpolatorDataContainer.Interpolators[ i ].VarName ):
				}
			}
			return string.Empty:
		}
Пример #4
0
		public string GetVertexData( TemplateInfoOnSematics info )
		{
			int count = m_vertexDataContainer.VertexData.Count:
			for( int i = 0: i < count: i++ )
			{
				if( m_vertexDataContainer.VertexData[ i ].DataInfo == info )
				{
					return string.Format( TemplateHelperFunctions.TemplateVarFormat, m_vertexFunctionData.InVarName, m_vertexDataContainer.VertexData[ i ].VarName ):
				}
			}
			return string.Empty:
		}
Пример #5
0
        public string GetVertexData(TemplateInfoOnSematics info)
        {
            int count = m_vertexData.Count;

            for (int i = 0; i < count; i++)
            {
                if (m_vertexData[i].DataInfo == info)
                {
                    return(string.Format(TemplateHelperFunctions.TemplateVarFormat, m_vertexFunctionData.InVarName, m_vertexData[i].VarName));
                }
            }
            return(string.Empty);
        }
Пример #6
0
 public TemplateVertexData(TemplateVertexData other)
 {
     m_semantics          = other.m_semantics;
     m_dataType           = other.m_dataType;
     m_varName            = other.m_varName;
     m_dataInfo           = other.m_dataInfo;
     m_dataSwizzle        = other.m_dataSwizzle;
     m_available          = other.m_available;
     m_varNameWithSwizzle = other.m_varNameWithSwizzle;
     m_isSingleComponent  = other.IsSingleComponent;
     for (int i = 0; i < 4; i++)
     {
         m_components[i] = other.Components[i];
     }
 }
Пример #7
0
		public TemplateVertexData( TemplateVertexData other )
		{
			m_semantics = other.m_semantics:
			m_dataType = other.m_dataType:
			m_varName = other.m_varName:
			m_dataInfo = other.m_dataInfo:
			m_dataSwizzle = other.m_dataSwizzle:
			m_available = other.m_available:
			m_varNameWithSwizzle = other.m_varNameWithSwizzle:
			m_isSingleComponent = other.IsSingleComponent:
			m_excludeStructPrefix = other.ExcludeStructPrefix:
			for( int i = 0: i < 4: i++ )
			{
				m_components[ i ] = other.Components[ i ]:
			}
		}
Пример #8
0
        // This should only be used to semantics outside the text coord set
        public string RegisterInfoOnSemantic(MasterNodePortCategory portCategory, TemplateInfoOnSematics info, TemplateSemantics semantic, string name, WirePortDataType dataType, bool requestNewInterpolator)
        {
            if (portCategory == MasterNodePortCategory.Vertex)
            {
                if (m_vertexDataDict.ContainsKey(semantic))
                {
                    return(m_vertexDataDict[semantic].VarName);
                }

                m_availableVertData.Add(info,
                                        new InterpDataHelper(WirePortDataType.FLOAT4,
                                                             string.Format(TemplateHelperFunctions.TemplateVarFormat,
                                                                           m_currentTemplateData.VertexFunctionData.InVarName,
                                                                           name)));

                m_currentDataCollector.AddToVertexInput(
                    string.Format(TemplateHelperFunctions.TexFullSemantic,
                                  name,
                                  semantic));
                RegisterOnVertexData(semantic, dataType, name);
                return(m_availableVertData[info].VarName);
            }
            else
            {
                //search if the correct vertex data is set ...
                TemplateSemantics vertexSemantics = TemplateSemantics.NONE;
                foreach (KeyValuePair <TemplateSemantics, TemplateVertexData> kvp in m_vertexDataDict)
                {
                    if (kvp.Value.DataInfo == info)
                    {
                        vertexSemantics = kvp.Key;
                        break;
                    }
                }

                // if not, add vertex data and create interpolator
                if (vertexSemantics == TemplateSemantics.NONE)
                {
                    vertexSemantics = semantic;

                    if (!m_vertexDataDict.ContainsKey(vertexSemantics))
                    {
                        m_availableVertData.Add(info,
                                                new InterpDataHelper(WirePortDataType.FLOAT4,
                                                                     string.Format(TemplateHelperFunctions.TemplateVarFormat,
                                                                                   m_currentTemplateData.VertexFunctionData.InVarName,
                                                                                   name)));

                        m_currentDataCollector.AddToVertexInput(
                            string.Format(TemplateHelperFunctions.TexFullSemantic,
                                          name,
                                          vertexSemantics));
                        RegisterOnVertexData(vertexSemantics, dataType, name);
                    }
                }

                // either way create interpolator

                TemplateVertexData availableInterp = null;
                if (requestNewInterpolator || IsSemanticUsedOnInterpolator(semantic))
                {
                    availableInterp = RequestNewInterpolator(dataType, false);
                }
                else
                {
                    availableInterp = RegisterOnInterpolator(semantic, dataType);
                }

                if (availableInterp != null)
                {
                    string interpVarName = m_currentTemplateData.VertexFunctionData.OutVarName + "." + availableInterp.VarNameWithSwizzle;
                    string interpDecl    = string.Format(TemplateHelperFunctions.TemplateVariableDecl, interpVarName, TemplateHelperFunctions.AutoSwizzleData(m_availableVertData[info].VarName, m_availableVertData[info].VarType, dataType));
                    m_currentDataCollector.AddToVertexInterpolatorsDecl(interpDecl);
                    string finalVarName = m_currentTemplateData.FragFunctionData.InVarName + "." + availableInterp.VarNameWithSwizzle;
                    m_availableFragData.Add(info, new InterpDataHelper(dataType, finalVarName));
                    return(finalVarName);
                }
            }
            return(string.Empty);
        }
Пример #9
0
 public string RegisterInfoOnSemantic(TemplateInfoOnSematics info, TemplateSemantics semantic, string name, WirePortDataType dataType, bool requestNewInterpolator)
 {
     return(RegisterInfoOnSemantic(m_currentDataCollector.PortCategory, info, semantic, name, dataType, requestNewInterpolator));
 }
Пример #10
0
        public InterpDataHelper GetInfo(TemplateInfoOnSematics info, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment)
        {
            MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory;

            return((category == MasterNodePortCategory.Fragment) ? m_availableFragData[info] : m_availableVertData[info]);
        }
Пример #11
0
        public bool HasInfo(TemplateInfoOnSematics info, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment)
        {
            MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory;

            return((category == MasterNodePortCategory.Fragment) ? m_availableFragData.ContainsKey(info) : m_availableVertData.ContainsKey(info));
        }
Пример #12
0
        public string RegisterUV(int UVChannel)
        {
            if (m_currentDataCollector.PortCategory == MasterNodePortCategory.Vertex)
            {
                TemplateSemantics semantic = TemplateHelperFunctions.IntToSemantic[UVChannel];

                if (m_vertexDataDict.ContainsKey(semantic))
                {
                    return(m_vertexDataDict[semantic].VarName);
                }

                string varName = TemplateHelperFunctions.BaseInterpolatorName + ((UVChannel > 0) ? UVChannel.ToString() : string.Empty);
                m_availableVertData.Add(TemplateHelperFunctions.IntToUVChannelInfo[UVChannel],
                                        new InterpDataHelper(WirePortDataType.FLOAT4,
                                                             string.Format(TemplateHelperFunctions.TemplateVarFormat,
                                                                           m_currentTemplateData.VertexFunctionData.InVarName,
                                                                           varName)));

                m_currentDataCollector.AddToVertexInput(
                    string.Format(TemplateHelperFunctions.TexFullSemantic,
                                  varName,
                                  semantic));
                RegisterOnVertexData(semantic, WirePortDataType.FLOAT2, varName);
                return(m_availableVertData[TemplateHelperFunctions.IntToUVChannelInfo[UVChannel]].VarName);
            }
            else
            {
                //search if the correct vertex data is set ...
                TemplateInfoOnSematics info            = TemplateHelperFunctions.IntToInfo[UVChannel];
                TemplateSemantics      vertexSemantics = TemplateSemantics.NONE;
                foreach (KeyValuePair <TemplateSemantics, TemplateVertexData> kvp in m_vertexDataDict)
                {
                    if (kvp.Value.DataInfo == info)
                    {
                        vertexSemantics = kvp.Key;
                        break;
                    }
                }

                // if not, add vertex data and create interpolator
                if (vertexSemantics == TemplateSemantics.NONE)
                {
                    vertexSemantics = TemplateHelperFunctions.IntToSemantic[UVChannel];

                    if (!m_vertexDataDict.ContainsKey(vertexSemantics))
                    {
                        string varName = TemplateHelperFunctions.BaseInterpolatorName + ((UVChannel > 0) ? UVChannel.ToString() : string.Empty);
                        m_availableVertData.Add(TemplateHelperFunctions.IntToUVChannelInfo[UVChannel],
                                                new InterpDataHelper(WirePortDataType.FLOAT4,
                                                                     string.Format(TemplateHelperFunctions.TemplateVarFormat,
                                                                                   m_currentTemplateData.VertexFunctionData.InVarName,
                                                                                   varName)));

                        m_currentDataCollector.AddToVertexInput(
                            string.Format(TemplateHelperFunctions.TexFullSemantic,
                                          varName,
                                          vertexSemantics));
                        RegisterOnVertexData(vertexSemantics, WirePortDataType.FLOAT2, varName);
                    }
                }

                // either way create interpolator
                TemplateVertexData availableInterp = RequestNewInterpolator(WirePortDataType.FLOAT2, false);
                if (availableInterp != null)
                {
                    string           interpVarName = m_currentTemplateData.VertexFunctionData.OutVarName + "." + availableInterp.VarNameWithSwizzle;
                    InterpDataHelper vertInfo      = m_availableVertData[TemplateHelperFunctions.IntToUVChannelInfo[UVChannel]];
                    string           interpDecl    = string.Format(TemplateHelperFunctions.TemplateVariableDecl, interpVarName, TemplateHelperFunctions.AutoSwizzleData(vertInfo.VarName, vertInfo.VarType, WirePortDataType.FLOAT2));
                    m_currentDataCollector.AddToVertexInterpolatorsDecl(interpDecl);
                    string finalVarName = m_currentTemplateData.FragFunctionData.InVarName + "." + availableInterp.VarNameWithSwizzle;
                    m_availableFragData.Add(TemplateHelperFunctions.IntToUVChannelInfo[UVChannel], new InterpDataHelper(WirePortDataType.FLOAT2, finalVarName));
                    return(finalVarName);
                }
            }
            return(string.Empty);
        }