Parse() public method

Parses the source element.
public Parse ( ) : IEnumerable
return IEnumerable
示例#1
0
        public void Parse_for_Normals()
        {
            var sourceElement = mMesh.Elements()
                .Where(s => s.Attribute("id").Value == "Plane-Geometry-Normals")
                .FirstOrDefault();
            Assert.IsNotNull(sourceElement);

            var sourceParser = new SourceParser(sourceElement);

            var normals = sourceParser.Parse();

            Assert.IsNotNull(normals);
            var expected = new[]
            {
                new[] { 0f, 0f, 1f },
                new[] { 0f, 0f, 1f },
            };
            Assert.AreElementsEqual(expected, normals.ToArray());
        }
示例#2
0
        public void Parse_for_Positions()
        {
            var sourceElement = mMesh.Elements()
                .Where(s => s.Attribute("id").Value == "Plane-Geometry-Position")
                .FirstOrDefault();
            Assert.IsNotNull(sourceElement);

            var sourceParser = new SourceParser(sourceElement);

            var positions = sourceParser.Parse();

            Assert.IsNotNull(positions);
            var expected = new[]
            {
                new[] { 1f, 1f, 0f },
                new[] { 1f, -1f, 0f },
                new[] { -1f, -1f, 0f },
                new[] { -1f, 1f, 0f }
            };
            Assert.AreElementsEqual(expected, positions.ToArray());
        }
示例#3
0
        public void Parse_for_Colors()
        {
            var sourceElement = mMesh.Elements()
                .Where(s => s.Attribute("id").Value == "Plane-Geometry-color")
                .FirstOrDefault();
            Assert.IsNotNull(sourceElement);

            var sourceParser = new SourceParser(sourceElement);

            var texCoords = sourceParser.Parse();

            Assert.IsNotNull(texCoords);
            var expected = new[]
            {
                new[] { 1f, 1f, 1f, 1f },
                new[] { 1f, 1f, 1f, 1f },
                new[] { 1f, 1f, 1f, 1f },
                new[] { 1f, 1f, 1f, 1f },
                new[] { 1f, 1f, 1f, 1f },
                new[] { 1f, 1f, 1f, 1f },
            };
            Assert.AreElementsEqual(expected, texCoords.ToArray());
        }