Ejemplo n.º 1
0
        public void TestLoadYamlThree()
        {
            var yaml   = _getMapping(TestDataThree);
            var loaded = TextureLoadParameters.FromYaml(yaml);

            Assert.That(loaded.SampleParameters.WrapMode, Is.EqualTo(TextureWrapMode.None));
        }
Ejemplo n.º 2
0
        public void TestLoadYamlTwo()
        {
            var yaml   = _getMapping(TestDataTwo);
            var loaded = TextureLoadParameters.FromYaml(yaml);

            Assert.That(loaded.SampleParameters.Filter, Is.EqualTo(false));
            Assert.That(loaded.SampleParameters.WrapMode, Is.EqualTo(TextureWrapMode.MirroredRepeat));
        }
Ejemplo n.º 3
0
        public void TestLoadYamlOne()
        {
            var yaml   = _getMapping(TestDataOne);
            var loaded = TextureLoadParameters.FromYaml(yaml);

            Assert.That(loaded.SampleParameters.Filter, Is.EqualTo(true));
            Assert.That(loaded.SampleParameters.WrapMode, Is.EqualTo(TextureWrapMode.Repeat));
        }
Ejemplo n.º 4
0
        public void TestLoadEmptySamplingYaml()
        {
            // Test whether it defaults for empty YAML.
            var yaml          = _getMapping("sample: {}\n");
            var loaded        = TextureLoadParameters.FromYaml(yaml);
            var defaultParams = TextureLoadParameters.Default;

            Assert.That(loaded.SampleParameters.Filter, Is.EqualTo(defaultParams.SampleParameters.Filter));
            Assert.That(loaded.SampleParameters.WrapMode, Is.EqualTo(defaultParams.SampleParameters.WrapMode));
        }
Ejemplo n.º 5
0
        public void TestLoadEmptyYaml()
        {
            // Test whether it defaults for empty YAML.
            var yaml          = new YamlMappingNode();
            var loaded        = TextureLoadParameters.FromYaml(yaml);
            var defaultParams = TextureLoadParameters.Default;

            Assert.That(loaded.SampleParameters.Filter, Is.EqualTo(defaultParams.SampleParameters.Filter));
            Assert.That(loaded.SampleParameters.WrapMode, Is.EqualTo(defaultParams.SampleParameters.WrapMode));
            Assert.That(loaded.Srgb, Is.EqualTo(defaultParams.Srgb));
        }
Ejemplo n.º 6
0
        private static TextureLoadParameters?_tryLoadTextureParameters(IResourceCache cache, ResourcePath path)
        {
            var metaPath = path.WithName(path.Filename + ".yml");

            if (cache.TryContentFileRead(metaPath, out var stream))
            {
                YamlDocument yamlData;
                using (var reader = new StreamReader(stream, EncodingHelpers.UTF8))
                {
                    var yamlStream = new YamlStream();
                    yamlStream.Load(reader);
                    if (yamlStream.Documents.Count == 0)
                    {
                        return(null);
                    }

                    yamlData = yamlStream.Documents[0];
                }

                return(TextureLoadParameters.FromYaml((YamlMappingNode)yamlData.RootNode));
            }
            return(null);
        }