示例#1
0
        public void Load(DataStreamPtr reader)
        {
            meshName = MBOgreUtil.LoadString(reader);

            uint flags = MBOgreUtil.LoadUInt32(reader);

            materialName = MBOgreUtil.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;
                }
            }

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

            uint v = MBOgreUtil.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 = MBOgreUtil.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      = MBOgreUtil.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     = MBOgreUtil.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();
            }
        }