예제 #1
0
        public void ErrorCheck()
        {
            if (BFRESRender != null)
            {
                List <Errors> Errors = new List <Errors>();
                foreach (FMDL model in BFRESRender.models)
                {
                    foreach (FSHP shp in model.shapes)
                    {
                        if (!IsWiiU)
                        {
                            Syroot.NintenTools.NSW.Bfres.VertexBuffer vtx  = shp.VertexBuffer;
                            Syroot.NintenTools.NSW.Bfres.Material     mat  = shp.GetMaterial().Material;
                            Syroot.NintenTools.NSW.Bfres.ShaderAssign shdr = mat.ShaderAssign;

                            for (int att = 0; att < vtx.Attributes.Count; att++)
                            {
                                if (!shdr.AttribAssigns.Contains(vtx.Attributes[att].Name))
                                {
                                    MessageBox.Show($"Error! Attribute {vtx.Attributes[att].Name} is unlinked!");
                                }
                            }
                            for (int att = 0; att < mat.TextureRefs.Count; att++)
                            {
                                if (!shdr.SamplerAssigns.Contains(mat.SamplerDict.GetKey(att))) //mat.SamplerDict[att]
                                {
                                    MessageBox.Show($"Error! Sampler {mat.SamplerDict.GetKey(att)} is unlinked!");
                                }
                            }
                        }
                        else
                        {
                            Syroot.NintenTools.Bfres.VertexBuffer vtx  = shp.VertexBufferU;
                            Syroot.NintenTools.Bfres.Material     mat  = shp.GetMaterial().MaterialU;
                            Syroot.NintenTools.Bfres.ShaderAssign shdr = mat.ShaderAssign;

                            for (int att = 0; att < vtx.Attributes.Count; att++)
                            {
                                if (!shdr.AttribAssigns.ContainsKey(vtx.Attributes[att].Name))
                                {
                                    MessageBox.Show($"Error! Attribute {vtx.Attributes[att].Name} is unlinked!");
                                }
                            }
                            for (int att = 0; att < mat.TextureRefs.Count; att++)
                            {
                                string samp = "";
                                mat.Samplers.TryGetKey(mat.Samplers[att], out samp);
                                if (!shdr.SamplerAssigns.ContainsKey(samp)) //mat.SamplerDict[att]
                                {
                                    MessageBox.Show($"Error! Sampler {samp} is unlinked!");
                                }
                            }
                        }
                    }
                }
                //   ErrorList errorList = new ErrorList();
                //   errorList.LoadList(Errors);
                //    errorList.Show();
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Material"/> class.
        /// </summary>
        public Material()
        {
            Name  = "";
            Flags = MaterialFlags.Visible;

            ShaderAssign = new ShaderAssign();

            RenderInfos  = new ResDict <RenderInfo>();
            TextureRefs  = new List <TextureRef>();
            Samplers     = new ResDict <Sampler>();
            UserData     = new ResDict <UserData>();
            ShaderParams = new ResDict <ShaderParam>();

            ShaderParamData = new byte[0];
            VolatileFlags   = new byte[0];
        }