Пример #1
0
        public IReadOnlyList <IModel> Load(string name, IFileSystem fileSystem, Scene scene, BinaryReader reader, bool computeCRC)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            //Check if we can actually load this
            if (!SpriteLoader.IsSpriteFile(reader))
            {
                return(null);
            }

            var loader = new SpriteLoader(reader);

            var spriteFile = loader.ReadSpriteFile();

            uint crc = 0;

            if (computeCRC)
            {
                crc = loader.ComputeCRC();
            }

            var model = new SpriteModel(name, crc, spriteFile);

            if (scene != null)
            {
                model.ResourceContainer = new SpriteModelResourceContainer(scene, model);

                scene.AddContainer(model.ResourceContainer);
            }

            return(new[] { model });
        }
Пример #2
0
        public IModel Load(string name, IFileSystem fileSystem, BinaryReader reader, Delegates.AddModel addModelCallback, bool computeCRC)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            //Check if we can actually load this
            if (!SpriteLoader.IsSpriteFile(reader))
            {
                return(null);
            }

            var loader = new SpriteLoader(reader);

            var spriteFile = loader.ReadSpriteFile();

            uint crc = 0;

            if (computeCRC)
            {
                crc = loader.ComputeCRC();
            }

            return(new SpriteModel(name, crc, spriteFile));
        }