示例#1
0
        public void ActivateShaderWithLightmap(ref TextureManager TexMgr)
        {
            if (false)           //NumTextureStages >= 4)
            {
                //setup LM, base, 2 details

                //MdxRender.Dev.TextureState[0].ColorOperation = TextureOperation.SelectArg1;
                //m_Lightmaps[l].Materials[m].DrawMaterial(ref shdr_mgr);

                MdxRender.Dev.TextureState[0].ColorArgument0 = TextureArgument.Current;
                MdxRender.Dev.TextureState[1].ColorArgument0 = TextureArgument.Current;

                //MdxRender.Dev.TextureState[0].ColorArgument1 = TextureArgument.TextureColor;
                //MdxRender.Dev.TextureState[0].ColorOperation = TextureOperation.Modulate;
            }
            else if (NumTextureStages >= 1)
            {
                //setup base+lightmap blend
                MdxRender.Dev.TextureState[0].ColorArgument0         = TextureArgument.TextureColor;
                MdxRender.Dev.TextureState[0].ColorOperation         = TextureOperation.Modulate2X;
                MdxRender.Dev.TextureState[0].TextureCoordinateIndex = 1;

                TexMgr.ActivateTexture(1, Stage1TextureIndex, 0);
                //MdxRender.Dev.TextureState[1].AlphaArgument1 = TextureArgument.TextureColor;
                //MdxRender.Dev.TextureState[1].AlphaArgument2 = TextureArgument.TextureColor;
                MdxRender.Dev.TextureState[1].ColorArgument1         = TextureArgument.TextureColor;
                MdxRender.Dev.TextureState[1].ColorArgument2         = TextureArgument.Current;
                MdxRender.Dev.TextureState[1].AlphaOperation         = TextureOperation.SelectArg1;
                MdxRender.Dev.TextureState[1].ColorOperation         = TextureOperation.Modulate;
                MdxRender.Dev.TextureState[1].TextureCoordinateIndex = 0;



                if (Environment_type == 1)
                {
                    //detail blend based on alpha map
                    TexMgr.ActivateTexture(3, Stage2TextureIndex, 0);
                    MdxRender.Dev.TextureState[3].ColorArgument1         = TextureArgument.Current;
                    MdxRender.Dev.TextureState[3].ColorArgument2         = TextureArgument.TextureColor;
                    MdxRender.Dev.TextureState[3].ColorOperation         = TextureOperation.BlendTextureAlpha;
                    MdxRender.Dev.TextureState[3].TextureCoordinateIndex = 0;
                }
                else
                {
                    //MdxRender.Dev.TextureState[3].ColorOperation = TextureOperation.Disable;
                }
            }
        }
        public virtual void ActivatePass1(ref TextureManager TexMgr)
        {
            if (bUseBaseShader)
            {
                TexMgr.ActivateTexture(0, 0, 0);
            }
            else
            {
                //Activate real textures
                if (NumTextureStages >= 1)
                {
                    TexMgr.ActivateTexture(0, Stage1TextureIndex, 0);
                }

                if (NumTextureStages >= 2)
                {
                    TexMgr.ActivateTexture(1, Stage2TextureIndex, 0);
                }
            }
        }