Esempio n. 1
0
        public void Load(DataStreamPtr reader)
        {
            name      = MBOgreUtil.LoadString(reader);
            flags     = MBOgreUtil.LoadUInt32(reader);
            requires  = MBOgreUtil.LoadUInt32(reader);
            technique = MBOgreUtil.LoadString(reader);
            uint k = MBOgreUtil.LoadUInt32(reader);

            if (k <= 1)
            {
                if (k == 1)
                {
                    fallback = MBOgreUtil.LoadString(reader);
                }
                else
                {
                    fallback = null;
                }
            }
            k   = MBOgreUtil.LoadUInt32(reader);
            opt = new List <MBBrfShaderOpt>();
            for (int i = 0; i < k; i++)
            {
                MBBrfShaderOpt o = new MBBrfShaderOpt();
                o.Load(reader);
                opt.Add(o);
            }
        }
Esempio n. 2
0
        public void Load(DataStreamPtr reader)
        {
            name = MBOgreUtil.LoadString(reader);
            List <TmpBone4> tmpBone4v = new List <TmpBone4>();
            uint            k         = MBOgreUtil.LoadUInt32(reader);

            for (int i = 0; i < k; i++)
            {
                TmpBone4 tmpBone = new TmpBone4();
                tmpBone.Load(reader);
                tmpBone4v.Add(tmpBone);
            }
            nbones = (int)k;

            List <TmpCas3F> tmpCas3f = new List <TmpCas3F>();

            k = MBOgreUtil.LoadUInt32(reader);
            for (int i = 0; i < k; i++)
            {
                TmpCas3F tmpcas3 = new TmpCas3F();
                tmpcas3.Load(reader);
                tmpCas3f.Add(tmpcas3);
            }

            MBUtil.TmpBone2BrfFrame(tmpBone4v, tmpCas3f, out frames);
        }
Esempio n. 3
0
 public void Load(DataStreamPtr reader)
 {
     if (globalVersion == 0)
     {
         index  = MBOgreUtil.LoadInt32(reader);
         col    = MBOgreUtil.LoadUInt32(reader);              // color x vert! as 4 bytes AABBGGRR
         __norm = MBOgreUtil.LoadPoint3F(reader);
         ta     = MBOgreUtil.LoadPoint2F(reader);
         ta.Y   = 1 - ta.Y;
         tb     = MBOgreUtil.LoadPoint2F(reader);
         tb.Y   = 1 - tb.Y;
     }
     else if (globalVersion == 1)
     {
         index  = MBOgreUtil.LoadInt32(reader);
         col    = MBOgreUtil.LoadUInt32(reader);              // color x vert! as 4 bytes AABBGGRR
         __norm = MBOgreUtil.LoadPoint3F(reader);
         tang   = MBOgreUtil.LoadPoint3F(reader);
         tangi  = MBOgreUtil.LoadByte(reader);
         ta     = MBOgreUtil.LoadPoint2F(reader);
         ta.Y   = 1 - ta.Y;
         tb     = ta;
     }
     else if (globalVersion == 2)
     {
         index  = MBOgreUtil.LoadInt32(reader);
         col    = MBOgreUtil.LoadUInt32(reader);              // color x vert! as 4 bytes AABBGGRR
         __norm = MBOgreUtil.LoadPoint3F(reader);
         ta     = MBOgreUtil.LoadPoint2F(reader);
         ta.Y   = 1 - ta.Y;
         tb     = ta;
     }
 }
Esempio n. 4
0
 public void Load(DataStreamPtr reader)
 {
     map     = MBOgreUtil.LoadInt32(reader);
     colorOp = MBOgreUtil.LoadUInt32(reader);
     alphaOp = MBOgreUtil.LoadUInt32(reader);
     flags   = MBOgreUtil.LoadUInt32(reader);
 }
Esempio n. 5
0
        public void Load(DataStreamPtr reader)
        {
            uint k = MBOgreUtil.LoadUInt32(reader);

            casList = new List <TmpCas4F>();
            for (int i = 0; i < k; i++)
            {
                TmpCas4F cas = new TmpCas4F();
                cas.Load(reader);
                casList.Add(cas);
            }
        }
Esempio n. 6
0
        public void Load(DataStreamPtr reader)
        {
            bindex = MBOgreUtil.LoadInt32(reader);
            uint k = MBOgreUtil.LoadUInt32(reader);

            pairs = new List <TmpRiggingPair>();
            for (uint i = 0; i < k; i++)
            {
                TmpRiggingPair pair = new TmpRiggingPair();
                pair.Load(reader);
                pairs.Add(pair);
            }
        }
Esempio n. 7
0
        public void Load(DataStreamPtr reader)
        {
            name = MBOgreUtil.LoadString(reader);

            uint k;

            k     = MBOgreUtil.LoadUInt32(reader);
            bones = new List <MBBrfBone>();
            for (int i = 0; i < k; i++)
            {
                MBBrfBone bone = new MBBrfBone();
                bone.Load(reader);
                bones.Add(bone);
            }
        }
Esempio n. 8
0
 public void Load(DataStreamPtr reader)
 {
     name     = MBOgreUtil.LoadString(reader);
     flags    = MBOgreUtil.LoadUInt32(reader);
     shader   = MBOgreUtil.LoadString(reader);
     diffuseA = MBOgreUtil.LoadString(reader);
     diffuseB = MBOgreUtil.LoadString(reader);
     bump     = MBOgreUtil.LoadString(reader);
     enviro   = MBOgreUtil.LoadString(reader);
     spec     = MBOgreUtil.LoadStringMaybe(reader, "none");
     specular = MBOgreUtil.LoadFloat(reader);
     r        = MBOgreUtil.LoadFloat(reader);
     g        = MBOgreUtil.LoadFloat(reader);
     b        = MBOgreUtil.LoadFloat(reader);
 }
Esempio n. 9
0
        public void Load(DataStreamPtr reader)
        {
            name = MBOgreUtil.LoadString(reader);
            string str = MBOgreUtil.LoadString(reader);

            if (str == "composite")
            {
                uint k = MBOgreUtil.LoadUInt32(reader);
                parts = new List <MBBrfBodyPart>();
                for (int i = 0; i < k; i++)
                {
                    MBBrfBodyPart part = new MBBrfBodyPart();
                    part.Load(reader);
                    parts.Add(part);
                }
            }
            else
            {
                MBBrfBodyPart part = new MBBrfBodyPart();
                part.Load(reader, str);
                parts.Add(part);
            }
        }
Esempio n. 10
0
        public void Load(DataStreamPtr reader, string str = null)
        {
            string firstWord = null;

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

                    MBOgreUtil.LoadVector(reader, ref pos);

                    int k = MBOgreUtil.LoadInt32(reader);
                    for (int i = 0; i < k; i++)
                    {
                        ori = MBOgreUtil.LoadInt32(reader);
                        int        h = MBOgreUtil.LoadInt32(reader);
                        List <int> v = new List <int>();
                        for (int j = 0; j < h; j++)
                        {
                            int pp = MBOgreUtil.LoadInt32(reader);
                            v.Add(pp);
                        }
                        faces.Add(v);
                    }
                }
                else if (firstWord == "capsule")
                {
                    type   = Type.CAPSULE;
                    radius = MBOgreUtil.LoadFloat(reader);
                    center = MBOgreUtil.LoadPoint3F(reader);
                    dir    = MBOgreUtil.LoadPoint3F(reader);
                    flags  = MBOgreUtil.LoadUInt32(reader);
                }
                else if (firstWord == "sphere")
                {
                    type   = Type.SPHERE;
                    radius = MBOgreUtil.LoadFloat(reader);
                    center = MBOgreUtil.LoadPoint3F(reader);
                    flags  = MBOgreUtil.LoadUInt32(reader);
                }
                else if (firstWord == "face")
                {
                    type = Type.FACE;
                    MBOgreUtil.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 = MBOgreUtil.LoadUInt32(reader);
                }
                else
                {
                    Console.WriteLine(string.Format("Unknown body (collision mesh) type `{0}`\n", firstWord));
                }
            }
        }
Esempio n. 11
0
 private unsafe void Load(DataStreamPtr reader)
 {
     globalVersion = 0;
     while (true)
     {
         string str = MBOgreUtil.LoadString(reader);
         if (str == "end" || reader.Eof())
         {
             break;
         }
         else if (str == "rfver ")
         {
             version       = MBOgreUtil.LoadInt32(reader);
             globalVersion = version;
         }
         else if (str == "mesh")
         {
             meshNum = MBOgreUtil.LoadUInt32(reader);
             for (int i = 0; i < meshNum; i++)
             {
                 MBBrfMesh brfMesh = new MBBrfMesh();
                 brfMesh.globalVersion = globalVersion;
                 brfMesh.Load(reader);
                 meshes.Add(brfMesh);
             }
         }
         else if (str == "texture")
         {
             textureNum = MBOgreUtil.LoadUInt32(reader);
             for (int i = 0; i < textureNum; i++)
             {
                 MBBrfTexture texture = new MBBrfTexture();
                 texture.Load(reader);
                 textures.Add(texture);
             }
         }
         else if (str == "shader")
         {
             shaderNum = MBOgreUtil.LoadUInt32(reader);
             for (int i = 0; i < shaderNum; i++)
             {
                 MBBrfShader shader = new MBBrfShader();
                 shader.Load(reader);
                 shaders.Add(shader);
             }
         }
         else if (str == "material")
         {
             materialNum = MBOgreUtil.LoadUInt32(reader);
             for (int i = 0; i < materialNum; i++)
             {
                 MBBrfMaterial material = new MBBrfMaterial();
                 material.Load(reader);
                 materials.Add(material);
             }
         }
         else if (str == "skeleton")
         {
             skeletonNum = MBOgreUtil.LoadUInt32(reader);
             for (int i = 0; i < skeletonNum; i++)
             {
                 MBBrfSkeleton skeleton = new MBBrfSkeleton();
                 skeleton.Load(reader);
                 skeletons.Add(skeleton);
             }
         }
         else if (str == "skeleton_anim")
         {
             skeletonAnimNum = MBOgreUtil.LoadUInt32(reader);
             for (int i = 0; i < skeletonAnimNum; i++)
             {
                 MBBrfAnimation skeletonAnim = new MBBrfAnimation();
                 skeletonAnim.Load(reader);
                 skeletonAnims.Add(skeletonAnim);
             }
         }
         else if (str == "body")
         {
             bodyNum = MBOgreUtil.LoadUInt32(reader);
             for (int i = 0; i < bodyNum; i++)
             {
                 MBBrfBody body = new MBBrfBody();
                 body.Load(reader);
                 bodies.Add(body);
             }
         }
     }
 }
Esempio n. 12
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();
            }
        }
Esempio n. 13
0
 public void Load(DataStreamPtr reader)
 {
     name  = MBOgreUtil.LoadString(reader);
     flags = MBOgreUtil.LoadUInt32(reader);
 }