Beispiel #1
0
        private void initMesh3d(string file, string layout)
        {
            string s = Utils.GetRootPath() + "\\Content\\export\\" + file;

            if (File.Exists(s) == false)
            {
                return;
            }

            FieldInfo myf = typeof(MeshInputElements10).GetField(layout);

            InputElement[] ie = (InputElement[])myf.GetValue(null);

            Stream          stream     = File.Open(s, FileMode.Open);
            BinaryFormatter bFormatter = new BinaryFormatter();

            object[] context = new object[] { Game.Device, ie };
            bFormatter.Context = new StreamingContext(StreamingContextStates.All, context);
            mesh3d             = (Mesh3D)bFormatter.Deserialize(stream);
            stream.Close();

            mesh3d.inputElements = ie;
            mesh3d.meshFileName  = file;

            mesh3d.ComputeBoundingBox();
        }