Esempio n. 1
0
        public override void SetupShaders(EffectMesh effectMesh)
        {
            var permutationKey = new MaterialShaderPluginPermutationKey(effectMesh.MeshData);

            // Determines the max number of bones from the currect graphics profile
            int defaultSkinningMaxBones = GraphicsDevice.Features.Profile <= GraphicsProfile.Level_9_3 ? 56 : 200;

            if (permutationKey.SkinningPosition)
            {
                DefaultShaderPass.Macros.Add(new ShaderMacro("SkinningMaxBones", defaultSkinningMaxBones));
                BasicShaderPlugin.ApplyMixinClass(DefaultShaderPass.Shader, new ShaderClassSource("TransformationSkinning"), true);
            }

            if (permutationKey.SkinningNormal)
            {
                BasicShaderPlugin.ApplyMixinClass(DefaultShaderPass.Shader, new ShaderClassSource("NormalSkinning"), true);
            }
            if (permutationKey.SkinningTangent)
            {
                BasicShaderPlugin.ApplyMixinClass(DefaultShaderPass.Shader, new ShaderClassSource("TangentSkinning"), true);
            }

            if (permutationKey.AlbedoMaterial != null)
            {
                BasicShaderPlugin.ApplyMixinClass(DefaultShaderPass.Shader, permutationKey.AlbedoMaterial, true);
            }
        }
Esempio n. 2
0
 protected bool Equals(MaterialShaderPluginPermutationKey other)
 {
     return(ShaderSourceComparer.Default.Equals(AlbedoMaterial, other.AlbedoMaterial) &&
            SkinningPosition.Equals(other.SkinningPosition) &&
            SkinningNormal.Equals(other.SkinningNormal) &&
            SkinningTangent.Equals(other.SkinningTangent) &&
            NeedAlphaBlending.Equals(other.NeedAlphaBlending));
 }