Exemplo 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);
            }
        }
Exemplo n.º 2
0
        public override void SetupShaders(EffectMesh effectMesh)
        {
            // Duplicate the main shader
            throw new System.NotImplementedException();
            EffectShaderPass mainShaderPass;

            //var mainShaderPass = FindShaderPassFromPlugin(RenderPassPlugin.MainTargetPlugin);
            DefaultShaderPass.Shader = (ShaderMixinSource)mainShaderPass.Shader.Clone();
            DefaultShaderPass.Macros.AddRange(mainShaderPass.Macros);
            DefaultShaderPass.SubMeshDataKey = mainShaderPass.SubMeshDataKey;

            // G-Buffer construction
            // ExtractGBuffer: Extract POSITION + NORMAL
            DefaultShaderPass.Shader.Mixins.Add("GBuffer");
            DefaultShaderPass.Shader.Mixins.Add("NormalVSStream");

            mainShaderPass.Shader.Mixins.Remove("PositionVSStream");
            mainShaderPass.Shader.Mixins.Remove("NormalVSStream");
            mainShaderPass.Shader.Mixins.Add("NormalVSGBuffer");
            mainShaderPass.Shader.Mixins.Add("SpecularPowerGBuffer");
            mainShaderPass.Shader.Mixins.Add("PositionVSGBuffer");

            // Apply Mixin
            if (Mixin != null)
            {
                BasicShaderPlugin.ApplyMixinClass(DefaultShaderPass.Shader, Mixin, true);
            }
        }
Exemplo n.º 3
0
        public override void SetupShaders(EffectMesh effectMesh)
        {
            // Duplicate the main shader
            throw new System.NotImplementedException();
            EffectShaderPass mainShaderPass;

            //var mainShaderPass = FindShaderPassFromPlugin(MainPlugin);
            DefaultShaderPass.Shader = (ShaderMixinSource)mainShaderPass.Shader.Clone();
            DefaultShaderPass.Macros.AddRange(mainShaderPass.Macros);
            DefaultShaderPass.SubMeshDataKey = mainShaderPass.SubMeshDataKey;

            BasicShaderPlugin.ApplyMixinClass(DefaultShaderPass.Shader, new ShaderClassSource("PickingRasterizer"), true);
        }
Exemplo n.º 4
0
        public override void SetupShaders(EffectMesh effectMesh)
        {
            var permutationKey = new TessellationPluginPermutationKey(effectMesh.MeshData);

            if (permutationKey != null && permutationKey.Tessellation != null)
            {
                int inputControlPointCount = 3;

                BasicShaderPlugin.ApplyMixinClass(DefaultShaderPass.Shader, permutationKey.Tessellation, true);

                // Apply Displacement AEN plugin if both AEN is available and displacement is active
                if (permutationKey.TessellationAEN)
                {
                    BasicShaderPlugin.ApplyMixinClass(DefaultShaderPass.Shader, new ShaderClassSource("TessellationDisplacementAEN"), true);
                    DefaultShaderPass.SubMeshDataKey = "TessellationAEN";
                    inputControlPointCount           = 12;
                }

                DefaultShaderPass.Macros.Add(new ShaderMacro("InputControlPointCount", inputControlPointCount));
                DefaultShaderPass.Macros.Add(new ShaderMacro("OutputControlPointCount", 3));
            }
        }