Beispiel #1
0
        public void SaveFile(string FileName)
        {
            int mdl = 0;

            foreach (Model fmdl in TargetWiiUBFRES.Models.Values)
            {
                int s = 0;
                foreach (Shape shp in fmdl.Shapes.Values)
                {
                    VertexBufferHelper helper = new VertexBufferHelper(fmdl.VertexBuffers[shp.VertexBufferIndex], TargetWiiUBFRES.ByteOrder);


                    foreach (VertexAttrib att in fmdl.VertexBuffers[shp.VertexBufferIndex].Attributes.Values)
                    {
                        switch (att.Name)
                        {
                        case "_t0":
                        {
                            VertexBufferHelperAttrib tangents = helper["_t0"];         // Access by name
                            int t = 0;
                            foreach (Vector4 tan in models[mdl].poly[s].vertices.tans)
                            {
                                tangents.Data[t] = new Syroot.Maths.Vector4F(tan.X, tan.Y, tan.Z, tan.W);
                                t++;
                            }
                        }
                        break;

                        case "_b0":
                        {
                            VertexBufferHelperAttrib bitangents = helper["_b0"];         // Access by name
                            int b = 0;
                            foreach (Vector4 bitan in models[mdl].poly[s].vertices.bitans)
                            {
                                bitangents.Data[b] = new Syroot.Maths.Vector4F(bitan.X, bitan.Y, bitan.Z, bitan.W);
                                b++;
                            }
                        }
                        break;
                        }
                    }
                    s++;
                }
                mdl++;
            }


            TargetWiiUBFRES.Save(FileName);
        }
Beispiel #2
0
        public void SaveFile(string FileName)
        {
            int mdl = 0;

            foreach (Model fmdl in TargetWiiUBFRES.Models.Values)
            {
                int s = 0;
                foreach (Shape shp in fmdl.Shapes.Values)
                {
                    VertexBufferHelper helper = new VertexBufferHelper(fmdl.VertexBuffers[shp.VertexBufferIndex], TargetWiiUBFRES.ByteOrder);


                    foreach (VertexAttrib att in fmdl.VertexBuffers[shp.VertexBufferIndex].Attributes.Values)
                    {
                        switch (att.Name)
                        {
                        case "_n0":
                        {
                            VertexBufferHelperAttrib normals = helper["_n0"];         // Access by name
                        }
                        break;

                        case "_t0":
                        {
                            VertexBufferHelperAttrib tangents = helper["_t0"];         // Access by name
                        }
                        break;

                        case "_b0":
                        {
                            VertexBufferHelperAttrib bitangents = helper["_b0"];         // Access by name
                        }
                        break;
                        }
                        fmdl.VertexBuffers[shp.VertexBufferIndex] = helper.ToVertexBuffer();
                    }
                    s++;
                }
                mdl++;
            }


            TargetWiiUBFRES.Save(FileName);
        }