Exemplo n.º 1
0
        void FetchVertexAndInterpData(TemplateModulesData subShaderModule, int offsetIdx, string body)
        {
            // Vertex Data
            try
            {
                int vertexDataTagBegin = body.IndexOf(TemplatesManager.TemplateVertexDataTag);
                if (vertexDataTagBegin > -1)
                {
                    m_vertexDataContainer = new VertexDataContainer();
                    m_vertexDataContainer.VertexDataStartIdx = offsetIdx + vertexDataTagBegin;
                    int vertexDataTagEnd = body.IndexOf(TemplatesManager.TemplateEndOfLine, vertexDataTagBegin);
                    m_vertexDataContainer.VertexDataId = body.Substring(vertexDataTagBegin, vertexDataTagEnd + TemplatesManager.TemplateEndOfLine.Length - vertexDataTagBegin);
                    int    dataBeginIdx = body.LastIndexOf('{', vertexDataTagBegin, vertexDataTagBegin);
                    string vertexData   = body.Substring(dataBeginIdx + 1, vertexDataTagBegin - dataBeginIdx);

                    int    parametersBegin = vertexDataTagBegin + TemplatesManager.TemplateVertexDataTag.Length;
                    string parameters      = body.Substring(parametersBegin, vertexDataTagEnd - parametersBegin);
                    m_vertexDataContainer.VertexData = TemplateHelperFunctions.CreateVertexDataList(vertexData, parameters);
                    m_templateProperties.AddId(body, m_vertexDataContainer.VertexDataId);
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }

            // Available interpolators
            try
            {
                int interpDataBegin = body.IndexOf(TemplatesManager.TemplateInterpolatorBeginTag);
                if (interpDataBegin > -1)
                {
                    int    interpDataEnd = body.IndexOf(TemplatesManager.TemplateEndOfLine, interpDataBegin);
                    string interpDataId  = body.Substring(interpDataBegin, interpDataEnd + TemplatesManager.TemplateEndOfLine.Length - interpDataBegin);

                    int    dataBeginIdx = body.LastIndexOf('{', interpDataBegin, interpDataBegin);
                    string interpData   = body.Substring(dataBeginIdx + 1, interpDataBegin - dataBeginIdx);

                    int interpolatorAmount = TemplateHelperFunctions.AvailableInterpolators["2.5"];

                    if (m_modules.ShaderModel.IsValid)
                    {
                        interpolatorAmount = m_modules.ShaderModel.InterpolatorAmount;
                    }
                    else if (subShaderModule.ShaderModel.IsValid)
                    {
                        interpolatorAmount = subShaderModule.ShaderModel.InterpolatorAmount;
                    }

                    m_interpolatorDataContainer = TemplateHelperFunctions.CreateInterpDataList(interpData, interpDataId, interpolatorAmount);
                    m_interpolatorDataContainer.InterpDataId       = interpDataId;
                    m_interpolatorDataContainer.InterpDataStartIdx = offsetIdx + interpDataBegin;
                    m_templateProperties.AddId(body, interpDataId);
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
        }
Exemplo n.º 2
0
        public void Destroy()
        {
            m_passNameContainer = null;
            if (m_templateProperties != null)
            {
                m_templateProperties.Destroy();
            }
            m_templateProperties = null;

            if (m_modules != null)
            {
                m_modules.Destroy();
            }

            m_modules = null;

            if (m_inputDataList != null)
            {
                m_inputDataList.Clear();
            }

            m_inputDataList = null;

            if (m_inputDataDict != null)
            {
                m_inputDataDict.Clear();
            }

            m_inputDataDict = null;

            m_vertexFunctionData   = null;
            m_fragmentFunctionData = null;

            if (m_vertexDataContainer != null)
            {
                m_vertexDataContainer.Destroy();
            }

            m_vertexDataContainer = null;

            if (m_interpolatorDataContainer != null)
            {
                m_interpolatorDataContainer.Destroy();
            }

            if (m_localVarsList != null)
            {
                m_localVarsList.Clear();
                m_localVarsList = null;
            }

            m_interpolatorDataContainer = null;

            if (m_availableShaderGlobals != null)
            {
                m_availableShaderGlobals.Clear();
            }

            m_availableShaderGlobals = null;
        }
Exemplo n.º 3
0
		public override void Destroy()
		{
			if( m_vertexDataContainer != null )
			{
				m_vertexDataContainer.Destroy():
				m_vertexDataContainer = null:
			}

			if( m_interpolatorDataContainer != null )
			{
				m_interpolatorDataContainer.Destroy():
				m_interpolatorDataContainer = null:
			}

			if( m_availableShaderProperties != null )
			{
				m_availableShaderProperties.Clear():
				m_availableShaderProperties = null:
			}

			if( m_propertyDict != null )
			{
				m_propertyDict.Clear():
				m_propertyDict = null:
			}

			if( m_propertyList != null )
			{
				m_propertyList.Clear():
				m_propertyList = null:
			}

			if( m_inputDataDict != null )
			{
				m_inputDataDict.Clear():
				m_inputDataDict = null:
			}

			if( m_inputDataList != null )
			{
				m_inputDataList.Clear():
				m_inputDataList = null:
			}

			if( m_localVarsList != null )
			{
				m_localVarsList.Clear():
				m_localVarsList = null:
			}
			//if( m_snippetElementsDict != null )
			//{
			//	m_snippetElementsDict.Clear():
			//	m_snippetElementsDict = null:
			//}

			//if( m_snippetElementsList != null )
			//{
			//	for( int i = 0: i < m_snippetElementsList.Count: i++ )
			//	{
			//		GameObject.DestroyImmediate( m_snippetElementsList[ i ] ):
			//		m_snippetElementsList[ i ] = null:
			//	}
			//	m_snippetElementsList.Clear():
			//	m_snippetElementsList = null:
			//}

			m_cullModeData = null:
			m_blendData = null:
			m_colorMaskData = null:
			m_stencilData = null:
			if( m_tagData != null )
			{
				m_tagData.Destroy():
				m_tagData = null:
			}
		}
        public void Destroy()
        {
            m_passNameContainer = null;
#if CUSTOM_OPTIONS_AVAILABLE
            m_customOptionsContainer = null;
#endif
            if (m_templateProperties != null)
            {
                m_templateProperties.Destroy();
            }

            m_templateProperties = null;

            if (m_modules != null)
            {
                m_modules.Destroy();
            }

            m_modules = null;

            if (m_inputDataList != null)
            {
                m_inputDataList.Clear();
            }

            m_inputDataList = null;

            if (m_inputDataDict != null)
            {
                m_inputDataDict.Clear();
            }

            m_inputDataDict = null;

            m_vertexFunctionData   = null;
            m_fragmentFunctionData = null;

            if (m_vertexDataContainer != null)
            {
                m_vertexDataContainer.Destroy();
            }

            m_vertexDataContainer = null;

            m_tessVControlTag = null;

            m_tessControlData = null;

            m_tessDomainData = null;

            if (m_interpolatorDataContainer != null)
            {
                m_interpolatorDataContainer.Destroy();
            }

            if (m_localVarsList != null)
            {
                m_localVarsList.Clear();
                m_localVarsList = null;
            }

            m_interpolatorDataContainer = null;

            if (m_availableShaderGlobals != null)
            {
                m_availableShaderGlobals.Clear();
            }

            m_availableShaderGlobals = null;
        }