コード例 #1
0
        void LoadSwatShader(TagFileName tfn)
        {
            TagSwat shdr = new TagSwat();

            try
            {
                shdr.Load(tfn);
                shdr.LoadTextures();
            }
            catch (Exception e)
            {
                Trace.WriteLine("Swat Shader Load failed: " + tfn.RelativePath + "(" + e.Message + ")");
                shdr.EnableDefaultShading();
            }

            m_LookupTable[LookupCount].index = (short)m_SwatArray.Count;
            m_SwatArray.Add(shdr);
        }
コード例 #2
0
 public void SetupStates(int shader_index)
 {
     if (shader_index >= 0)
     {
         // TEST CODE: Enable scrolling texture on transparant chicago shaders.
         if (m_LookupTable[shader_index].type == ShaderType.Schi)
         {
             TagSchi s = (TagSchi)m_SchiArray[m_LookupTable[shader_index].index];
             s.UpdateShaderAnimation();
         }
         else if (m_LookupTable[shader_index].type == ShaderType.Scex)
         {
             TagScex s = (TagScex)m_ScexArray[m_LookupTable[shader_index].index];
             s.UpdateShaderAnimation();
         }
         else if (m_LookupTable[shader_index].type == ShaderType.Swat)
         {
             TagSwat s = (TagSwat)m_SwatArray[m_LookupTable[shader_index].index];
             s.UpdateShaderAnimation();
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Call ActivateShader from the model/bsp "draw" function.  It will set up
        /// the appropriate texture stages, etc.
        /// </summary>
        public bool ActivateShader(int shader_index, ShaderPass pass)
        {
            bool bDoneProcessing = true;

            if (shader_index < UTIL_SHADER_MAX)
            {
                ActivateUtilShader(shader_index);
            }
            else
            {
                switch (m_LookupTable[shader_index].type)
                {
                case ShaderType.Soso:
                    TagSoso tsoso = (TagSoso)m_SosoArray[m_LookupTable[shader_index].index];
                    if (pass == ShaderPass.First)
                    {
                        tsoso.Pass1();
                        bDoneProcessing = true;
                    }
                    else if (pass == ShaderPass.Second)
                    {
                        tsoso.Pass2();
                        bDoneProcessing = true;
                    }
                    break;

                case ShaderType.Shad:
                    TagShad tshad = (TagShad)m_ShadArray[m_LookupTable[shader_index].index];
                    tshad.SetupBlendFunction();
                    tshad.ActivatePass1(ref m_TextureManager);
                    break;

                case ShaderType.Senv:
                    TagSenv tsenv = (TagSenv)m_SenvArray[m_LookupTable[shader_index].index];
                    if (pass == ShaderPass.First)
                    {
                        tsenv.Pass1();
                        bDoneProcessing = true;
                    }
                    break;

                case ShaderType.Schi:
                    TagSchi tschi = (TagSchi)m_SchiArray[m_LookupTable[shader_index].index];
                    if (pass == ShaderPass.First)
                    {
                        tschi.TwoStage_Pass1();
                        bDoneProcessing = true;
                    }
                    break;

                case ShaderType.Scex:
                    TagScex tscex = (TagScex)m_ScexArray[m_LookupTable[shader_index].index];
                    if (pass == ShaderPass.First)
                    {
                        tscex.Pass1();
                        bDoneProcessing = true;
                    }
                    break;

                case ShaderType.Sgla:
                    TagSgla tsgla = (TagSgla)m_SglaArray[m_LookupTable[shader_index].index];
                    if (pass == ShaderPass.First)
                    {
                        tsgla.Pass1();
                        bDoneProcessing = true;
                    }
                    break;

                case ShaderType.Swat:
                    TagSwat tswat = (TagSwat)m_SwatArray[m_LookupTable[shader_index].index];
                    if (pass == ShaderPass.First)
                    {
                        tswat.Pass1();
                        bDoneProcessing = true;
                    }
                    break;

                default:
                    ShaderBase shdr = new ShaderBase();
                    shdr.SetupBlendFunction();
                    break;
                }
            }

            return(bDoneProcessing);
        }