コード例 #1
0
        public void RegisterShader(TagFileName tfn)
        {
            m_ShaderName  = tfn;
            m_ShaderIndex = MdxRender.SM.RegisterShader(tfn);

            //check to see if we need to do polygon sorting (two sided transparent)
            ShaderType st = MdxRender.SM.GetShaderType(tfn.TagClass);

            switch (st)
            {
            case ShaderType.Schi:
                TagSchi ts = MdxRender.SM.GetSchiShader(m_ShaderIndex);
                bUsesTwoSidedTransparentShader = ts.TwoSided;
                break;

            case ShaderType.Scex:
                TagScex tc = MdxRender.SM.GetScexShader(m_ShaderIndex);
                bUsesTwoSidedTransparentShader = tc.TwoSided;
                break;

            case ShaderType.Soso:
                TagSoso ss = MdxRender.SM.GetSosoShader(m_ShaderIndex);
                bUsesTwoSidedTransparentShader = ss.TwoSided;
                break;
            }

            if (bUsesTwoSidedTransparentShader)
            {
                ConvertTriStripToList();
                Trace.WriteLine("Two Sided Shader:  " + tfn.RelativePath);
            }
        }
コード例 #2
0
        public TagScex GetScexShader(int index)
        {
            TagScex ts = null;

            if (m_LookupTable[index].type == ShaderType.Scex)
            {
                ts = (TagScex)m_ScexArray[m_LookupTable[index].index];
            }
            return(ts);
        }
コード例 #3
0
        void LoadScexShader(TagFileName tfn)
        {
            TagScex shdr = new TagScex();

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

            m_LookupTable[LookupCount].index = (short)m_ScexArray.Count;
            m_ScexArray.Add(shdr);
        }
コード例 #4
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();
         }
     }
 }
コード例 #5
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);
        }