Пример #1
0
        public static void SetRenderTexture(this KingdomShader shader, EffectPass pass, IKingdomTexture texture)
        {
            if (shader.Texture0 != texture.Texture2D)
            {
                shader.Texture0 = texture.Texture2D;
                switch (texture.AddressU)
                {
                case ModelTexture.TextureWrapMode.Clamp:
                    shader.SetTextureRegionUDefault();
                    shader.TextureWrapModeU = TextureWrapMode.Clamp;
                    break;

                case ModelTexture.TextureWrapMode.Repeat:
                    shader.SetTextureRegionUDefault();
                    shader.TextureWrapModeU = TextureWrapMode.Repeat;
                    break;

                case ModelTexture.TextureWrapMode.RegionClamp:
                    shader.SetTextureRegionU(texture.RegionU);
                    shader.TextureWrapModeU = TextureWrapMode.Clamp;
                    break;

                case ModelTexture.TextureWrapMode.RegionRepeat:
                    shader.SetTextureRegionU(texture.RegionU);
                    shader.TextureWrapModeU = TextureWrapMode.Repeat;
                    break;
                }
                switch (texture.AddressV)
                {
                case ModelTexture.TextureWrapMode.Clamp:
                    shader.SetTextureRegionVDefault();
                    shader.TextureWrapModeV = TextureWrapMode.Clamp;
                    break;

                case ModelTexture.TextureWrapMode.Repeat:
                    shader.SetTextureRegionVDefault();
                    shader.TextureWrapModeV = TextureWrapMode.Repeat;
                    break;

                case ModelTexture.TextureWrapMode.RegionClamp:
                    shader.SetTextureRegionV(texture.RegionV);
                    shader.TextureWrapModeV = TextureWrapMode.Clamp;
                    break;

                case ModelTexture.TextureWrapMode.RegionRepeat:
                    shader.SetTextureRegionV(texture.RegionV);
                    shader.TextureWrapModeV = TextureWrapMode.Repeat;
                    break;
                }

                pass.Apply();
            }
        }
Пример #2
0
 public static void SetRenderTexture(this KingdomShader shader, EffectPass pass, Texture2D texture)
 {
     if (shader.Texture0 != texture)
     {
         shader.Texture0 = texture;
         shader.SetTextureRegionVDefault();
         shader.SetTextureRegionUDefault();
         shader.TextureWrapModeU = TextureWrapMode.Clamp;
         shader.TextureWrapModeV = TextureWrapMode.Clamp;
         pass.Apply();
     }
 }