Save() public static method

public static Save ( Stream stream, bool compress, SoftwareModel softwareModel, bool loadColors, bool loadUVs, bool loadNormals ) : void
stream Stream
compress bool
softwareModel SoftwareModel
loadColors bool
loadUVs bool
loadNormals bool
return void
Example #1
0
        public Model(IDisposableResource parent, SoftwareModel softwareModel, bool loadColors, bool loadUVs, bool loadNormals, string contentDirectory, Dictionary <string, Type> materialTypes, List <MaterialFieldBinder> value1BinderTypes, List <MaterialFieldBinder> value2BinderTypes, List <MaterialFieldBinder> value3BinderTypes, List <MaterialFieldBinder> value4BinderTypes, List <MaterialFieldBinder> textureBinderTypes, Dictionary <string, string> fileExtOverrides, int classicInstanceCount, Loader.LoadedCallbackMethod loadedCallback)
            : base(parent)
        {
            Loader.AddLoadable(this);
            new LoadWaiter(new ILoadable[] { softwareModel },
                           delegate(object sender, bool succeeeded)
            {
                if (succeeeded)
                {
                    using (var stream = new MemoryStream())
                    {
                        try
                        {
                            Model.Save(stream, false, softwareModel, loadColors, loadUVs, loadNormals);
                            stream.Position = 0;
                        }
                        catch (Exception e)
                        {
                            FailedToLoad = true;
                            Dispose();
                            if (loadedCallback != null)
                            {
                                loadedCallback(this, false);
                            }
                        }

                        if (!FailedToLoad)
                        {
                            init(null, stream, contentDirectory, materialTypes, value1BinderTypes, value2BinderTypes, value3BinderTypes, value4BinderTypes, textureBinderTypes, fileExtOverrides, classicInstanceCount, loadedCallback);
                        }
                    }
                }
                else
                {
                    FailedToLoad = true;
                    Dispose();
                    if (loadedCallback != null)
                    {
                        loadedCallback(this, false);
                    }
                }
            });
        }