Пример #1
0
        private void FromFile_Materials(Kn5Reader reader)
        {
            try {
                var count = reader.ReadInt32();

                Materials = new Dictionary <string, Kn5Material>(count);

                for (var i = 0; i < count; i++)
                {
                    var material = reader.ReadMaterial();
                    Materials[material.Name] = material;
                }
            } catch (NotImplementedException) {
                Materials = null;
            }
        }
Пример #2
0
        private void FromFile_Textures(Kn5Reader reader, [NotNull] IKn5TextureLoader textureLoader)
        {
            try {
                var count = reader.ReadInt32();

                Textures     = new Dictionary <string, Kn5Texture>(count);
                TexturesData = new Dictionary <string, byte[]>(count);

                for (var i = 0; i < count; i++)
                {
                    var texture = reader.ReadTexture();
                    if (texture.Length > 0)
                    {
                        Textures[texture.Name]     = texture;
                        TexturesData[texture.Name] = textureLoader.LoadTexture(texture.Name, reader.BaseStream, texture.Length) ?? new byte[0];
                    }
                }
            } catch (NotImplementedException) {
                Textures     = null;
                TexturesData = null;
            }
        }
Пример #3
0
        private void FromFile_Textures(Kn5Reader reader) {
            try {
                var count = reader.ReadInt32();

                Textures = new Dictionary<string, Kn5Texture>(count);
                TexturesData = new Dictionary<string, byte[]>(count);

                for (var i = 0; i < count; i++) {
                    var texture = reader.ReadTexture();
                    if (!Textures.ContainsKey(texture.Name)) {
                        Textures[texture.Name] = texture;
                        TexturesData[texture.Name] = reader.ReadBytes(texture.Length);
                    } else {
                        reader.BaseStream.Seek(texture.Length, SeekOrigin.Current);
                    }
                }
            } catch (NotImplementedException) {
                Textures = null;
                TexturesData = null;
            }
        }
Пример #4
0
        private void FromFile_Materials(Kn5Reader reader) {
            try {
                var count = reader.ReadInt32();

                Materials = new Dictionary<string, Kn5Material>(count);

                for (var i = 0; i < count; i++) {
                    var material = reader.ReadMaterial();
                    Materials[material.Name] = material;
                }
            } catch (NotImplementedException) {
                Materials = null;
            }
        }