Afterglow.Graphics.SourceParser.Parse C# (CSharp) Method

Parse() public method

Parses the source element.
public Parse ( ) : IEnumerable
return IEnumerable
        public IEnumerable<float[]> Parse()
        {
            var floats = ParseFloatArray(mSourceElement.Element(
                ColladaImporter.Namespace + "float_array"));

            var strideValue = mSourceElement
                .Element(ColladaImporter.Namespace + "technique_common")
                .Element(ColladaImporter.Namespace + "accessor")
                .Attribute("stride").Value;

            var stride = Convert.ToInt32(strideValue, CultureInfo.InvariantCulture);

            var vectors = floats.Slice(stride);

            return vectors;
        }

Usage Example

Example #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());
        }
All Usage Examples Of Afterglow.Graphics.SourceParser::Parse