コード例 #1
0
ファイル: MBBrfShader.cs プロジェクト: TYoung86/OpenMB
 public void Load(BinaryReader reader)
 {
     map     = MBUtil.LoadInt32(reader);
     colorOp = MBUtil.LoadUInt32(reader);
     alphaOp = MBUtil.LoadUInt32(reader);
     flags   = MBUtil.LoadUInt32(reader);
 }
コード例 #2
0
 public void Load(BinaryReader reader)
 {
     if (globalVersion == 0)
     {
         index  = MBUtil.LoadInt32(reader);
         col    = MBUtil.LoadUInt32(reader);              // color x vert! as 4 bytes AABBGGRR
         __norm = MBUtil.LoadPoint3F(reader);
         ta     = MBUtil.LoadPoint2F(reader);
         ta.Y   = 1 - ta.Y;
         tb     = MBUtil.LoadPoint2F(reader);
         tb.Y   = 1 - tb.Y;
     }
     else if (globalVersion == 1)
     {
         index  = MBUtil.LoadInt32(reader);
         col    = MBUtil.LoadUInt32(reader);              // color x vert! as 4 bytes AABBGGRR
         __norm = MBUtil.LoadPoint3F(reader);
         tang   = MBUtil.LoadPoint3F(reader);
         tangi  = MBUtil.LoadByte(reader);
         ta     = MBUtil.LoadPoint2F(reader);
         ta.Y   = 1 - ta.Y;
         tb     = ta;
     }
     else if (globalVersion == 2)
     {
         index  = MBUtil.LoadInt32(reader);
         col    = MBUtil.LoadUInt32(reader);              // color x vert! as 4 bytes AABBGGRR
         __norm = MBUtil.LoadPoint3F(reader);
         ta     = MBUtil.LoadPoint2F(reader);
         ta.Y   = 1 - ta.Y;
         tb     = ta;
     }
 }
コード例 #3
0
 public bool Load(BinaryReader reader)
 {
     index[0] = MBUtil.LoadInt32(reader);
     index[1] = MBUtil.LoadInt32(reader);
     index[2] = MBUtil.LoadInt32(reader);
     return(true);
 }
コード例 #4
0
ファイル: MBBrfSkeleton.cs プロジェクト: AlkanV/OpenMB
 //private List<int> next;
 public void Load(BinaryReader reader)
 {
     attach = MBUtil.LoadInt32(reader);
     if (!string.IsNullOrEmpty(MBUtil.LoadStringMaybe(reader, "bone")))
     {
         b = MBUtil.LoadInt32(reader);
     }
     x = MBUtil.LoadPoint3F(reader);
     y = MBUtil.LoadPoint3F(reader);
     z = MBUtil.LoadPoint3F(reader);
     t = MBUtil.LoadPoint3F(reader);
 }
コード例 #5
0
        public void Load(BinaryReader reader)
        {
            bindex = MBUtil.LoadInt32(reader);
            uint k = MBUtil.LoadUInt32(reader);

            pairs = new List <TmpRiggingPair>();
            for (uint i = 0; i < k; i++)
            {
                TmpRiggingPair pair = new TmpRiggingPair();
                pair.Load(reader);
                pairs.Add(pair);
            }
        }
コード例 #6
0
ファイル: MBBrfAnimation.cs プロジェクト: TYoung86/OpenMB
 public void Load(BinaryReader reader)
 {
     findex = MBUtil.LoadInt32(reader);
     rot    = MBUtil.LoadPoint4F(reader);
 }
コード例 #7
0
        public void Load(BinaryReader reader, string str = null)
        {
            string firstWord = null;

            if (string.IsNullOrEmpty(str))
            {
                firstWord = MBUtil.LoadString(reader);
            }
            else
            {
                faces     = new List <List <int> >();
                firstWord = str;
                if (firstWord == "manifold")
                {
                    type = Type.MANIFOLD;

                    MBUtil.LoadVector(reader, ref pos);

                    int k = MBUtil.LoadInt32(reader);
                    for (int i = 0; i < k; i++)
                    {
                        ori = MBUtil.LoadInt32(reader);
                        int        h = MBUtil.LoadInt32(reader);
                        List <int> v = new List <int>();
                        for (int j = 0; j < h; j++)
                        {
                            int pp = MBUtil.LoadInt32(reader);
                            v.Add(pp);
                        }
                        faces.Add(v);
                    }
                }
                else if (firstWord == "capsule")
                {
                    type   = Type.CAPSULE;
                    radius = MBUtil.LoadFloat(reader);
                    center = MBUtil.LoadPoint3F(reader);
                    dir    = MBUtil.LoadPoint3F(reader);
                    flags  = MBUtil.LoadUInt32(reader);
                }
                else if (firstWord == "sphere")
                {
                    type   = Type.SPHERE;
                    radius = MBUtil.LoadFloat(reader);
                    center = MBUtil.LoadPoint3F(reader);
                    flags  = MBUtil.LoadUInt32(reader);
                }
                else if (firstWord == "face")
                {
                    type = Type.FACE;
                    MBUtil.LoadVector(reader, ref pos);

                    int        k     = pos.Count;
                    List <int> aface = new List <int>();
                    for (int i = 0; i < k; i++)
                    {
                        aface.Add(i);
                    }
                    faces.Add(aface);

                    flags = MBUtil.LoadUInt32(reader);
                }
                else
                {
                    Console.WriteLine(string.Format("Unknown body (collision mesh) type `{0}`\n", firstWord));
                }
            }
        }
コード例 #8
0
        public void Load(BinaryReader reader)
        {
            meshName = MBUtil.LoadString(reader);

            uint flags = reader.ReadUInt32();

            materialName = MBUtil.LoadString(reader);

            MBBrfFrame oneFrame = new MBBrfFrame();

            frames = new List <MBBrfFrame>(1)
            {
                oneFrame
            };

            if (globalVersion != 0)
            {
                int  offset = 1 << 16;
                uint ret    = (uint)(flags & offset);
                if (ret == offset)
                {
                    globalVersion = 1;
                }
                else
                {
                    globalVersion = 2;
                }
            }

            MBUtil.LoadVector(reader, ref frames[0].pos);

            uint v = MBUtil.LoadUInt32(reader);
            List <TmpSkinning> tmpRig = new List <TmpSkinning>();

            for (int i = 0; i < v; i++)
            {
                TmpSkinning tmpR = new TmpSkinning();
                tmpR.Load(reader);
                tmpRig.Add(tmpR);
            }

            int k;

            k = MBUtil.LoadInt32(reader);
            for (int i = 0; i < k; i++)
            {
                if (i == 0)
                {
                    frames[0].Load(reader);
                }
                else
                {
                    MBBrfFrame frame = new MBBrfFrame();
                    frame.Load(reader);
                    frames.Add(frame);
                }
            }

            v      = MBUtil.LoadUInt32(reader);
            Vertex = new List <MBBrfVert>();
            for (uint i = 0; i < v; i++)
            {
                MBBrfVert vert = new MBBrfVert()
                {
                    globalVersion = globalVersion
                };
                vert.Load(reader);
                vertex.Add(vert);
            }

            v     = MBUtil.LoadUInt32(reader);
            faces = new List <MBBrfFace>();
            for (uint i = 0; i < v; i++)
            {
                MBBrfFace face = new MBBrfFace()
                {
                    globalVersion = globalVersion
                };
                face.Load(reader);
                faces.Add(face);
            }

            skinning = new List <MBBrfSkinning>();
            for (int i = 0; i < oneFrame.pos.Count; i++)
            {
                skinning.Add(new MBBrfSkinning());
            }
            if (tmpRig.Count > 0)
            {
                MBUtil.TmpRigging2Rigging(ref tmpRig, ref skinning);
            }
            else
            {
                skinning.Clear();
            }
        }
コード例 #9
0
 public void Load(BinaryReader reader)
 {
     vindex = MBUtil.LoadInt32(reader);
     weight = MBUtil.LoadFloat(reader);
 }
コード例 #10
0
 public void Load(BinaryReader reader)
 {
     time = MBUtil.LoadInt32(reader);
     MBUtil.LoadVector(reader, ref pos);
     MBUtil.LoadVector(reader, ref norm);
 }