Ejemplo n.º 1
0
        public override void ReloadProgram(BfresMeshAsset mesh)
        {
            ProgramPasses.Clear();

            var mat = mesh.Shape.Material;

            //Find index via option choices
            Dictionary <string, string> options = new Dictionary <string, string>();

            foreach (var op in mat.Material.ShaderAssign.ShaderOptions)
            {
                options.Add(op.Key, op.Value);
            }

            //Update option from render state
            this.LoadRenderStateOptions(options, mat);

            //Dynamic options.
            options["cSkinWeightNum"] = mesh.Shape.VertexSkinCount.ToString();
            options.Add("system_id", "0");

            int programIndex = ShaderModel.GetProgramIndex(options);

            if (programIndex == -1)
            {
                return;
            }

            this.ProgramPasses.Add(ShaderModel.GetShaderProgram(programIndex));
        }
Ejemplo n.º 2
0
        public override void ReloadProgram(BfresMeshAsset mesh)
        {
            ProgramPasses.Clear();

            //Keep things simple and add all the programs (game does not rely on variations)
            for (int i = 0; i < ShaderModel.ProgramCount; i++)
            {
                this.ProgramPasses.Add(ShaderModel.GetShaderProgram(i));
            }
        }
Ejemplo n.º 3
0
        public override void ReloadProgram(BfresMeshAsset mesh)
        {
            ProgramPasses.Clear();

            var mat = mesh.Shape.Material;

            //Find index via option choices
            Dictionary <string, string> options = new Dictionary <string, string>();

            foreach (var op in mat.ShaderOptions)
            {
                options.Add(op.Key, op.Value);
            }

            if (!options.ContainsKey("gsys_alpha_test_enable"))
            {
                options.Add("gsys_alpha_test_enable", "0");
            }
            if (!options.ContainsKey("gsys_alpha_test_func"))
            {
                options.Add("gsys_alpha_test_func", "6");
            }

            //Update option from render state
            this.LoadRenderStateOptions(options, mat);

            //Dynamic options.
            options.Add("gsys_weight", mesh.Shape.VertexSkinCount.ToString());
            options.Add("gsys_assign_type", "gsys_assign_material");
            options.Add("system_id", "0");
            options.Add("gsys_index_stream_format", "0");

            Console.WriteLine($"Reloading Shader Program {mesh.Name}");

            //The assign type has it's own set of programs for different passes
            foreach (var option in ShaderModel.DynamiOptions[2].ChoiceDict.GetKeys())
            {
                if (string.IsNullOrEmpty(option))
                {
                    continue;
                }

                options["gsys_assign_type"] = option;
                int programIndex = ShaderModel.GetProgramIndex(options);
                if (programIndex == -1)
                {
                    Console.WriteLine($"Failed to find program! {mesh.Name}");
                    continue;
                }

                this.ProgramPasses.Add(ShaderModel.GetShaderProgram(programIndex));
            }
        }
        public override void ReloadProgram(BfresMeshAsset mesh)
        {
            ProgramPasses.Clear();

            //Find the variation index by material options
            var mat = mesh.Shape.Material;

            //Find index via option choices
            Dictionary <string, string> options = new Dictionary <string, string>();

            foreach (var op in mat.Material.ShaderAssign.ShaderOptions)
            {
                options.Add(op.Key, op.Value);
            }

            //Update option from render state
            this.LoadRenderStateOptions(options, mat);

            //Dynamic options.
            options.Add("gsys_weight", mesh.Shape.VertexSkinCount.ToString());
            options.Add("gsys_assign_type", "gsys_assign_material");
            options.Add("system_id", "0");

            //The assign type has it's own set of programs for different passes
            foreach (var option in ShaderModel.DynamiOptions[1].ChoiceDict.GetKeys())
            {
                if (string.IsNullOrEmpty(option))
                {
                    continue;
                }

                options["gsys_assign_type"] = option;
                if (options["gsys_assign_type"] != "gsys_assign_gbuffer")
                {
                    continue;
                }

                int programIndex = ShaderModel.GetProgramIndex(options);
                if (programIndex == -1)
                {
                    continue;
                }

                this.ProgramPasses.Add(ShaderModel.GetShaderProgram(programIndex));
            }
        }
Ejemplo n.º 5
0
        public override void ReloadProgram(BfresMeshAsset mesh)
        {
            ProgramPasses.Clear();

            var mat = mesh.Shape.Material;

            //Find index via option choices
            Dictionary <string, string> options = new Dictionary <string, string>();

            foreach (var op in mat.ShaderOptions)
            {
                options.Add(op.Key, op.Value);
            }

            //Update option from render state
            this.LoadRenderStateOptions(options, mat);

            //Dynamic options.
            options["cSkinWeightNum"] = mesh.Shape.VertexSkinCount.ToString();
            options.Add("enable_compose_footprint", "0");
            options.Add("enable_compose_capture", "0");
            options.Add("enable_add_stain_proc_texture_3d", "0");
            options.Add("compose_prog_texture0", "0");
            options.Add("enable_parallax_cubemap", "0");
            options.Add("is_output_motion_vec", "0");
            options.Add("material_lod_level", "0");
            options.Add("system_id", "0");

            int programIndex = ShaderModel.GetProgramIndex(options);

            if (programIndex == -1)
            {
                return;
            }

            this.ProgramPasses.Add(ShaderModel.GetShaderProgram(programIndex));
        }