< Summary

Line coverage
98%
Covered lines: 571
Uncovered lines: 7
Coverable lines: 578
Total lines: 1427
Line coverage: 98.7%
Branch coverage
98%
Covered branches: 558
Total branches: 569
Branch coverage: 98%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
MoveNextSkipEmpty(...)100%44100%
MoveNextSkipEmpty(...)100%44100%
GetNextValue(...)100%11100%
GetNextValue(...)100%11100%
TryFloatParse(...)100%11100%
TryIntParse(...)100%11100%
FromStream(...)97.85%326326100%
ParseMaterialColor(...)100%3636100%
ParseMaterialColor(...)100%3636100%
ParseMaterialMap(...)100%11100%
ParseMaterialMap(...)100%11100%
ParseMaterialMap(...)98.02%20420397.26%
ParseMaterialMap(...)98.02%20420397.26%

File(s)

https://raw.githubusercontent.com/JeremyAnsel/JeremyAnsel.Media.WavefrontObj/7b5b951766c69f14731a856f32198cdbf1fc6847/JeremyAnsel.Media.WavefrontObj/JeremyAnsel.Media.WavefrontObj/ObjMaterialFileReader9.cs

#LineLine coverage
 1// <copyright file="ObjMaterialFileReader9.cs" company="Jérémy Ansel">
 2// Copyright (c) 2017, 2019 Jérémy Ansel
 3// </copyright>
 4// <license>
 5// Licensed under the MIT license. See LICENSE.txt
 6// </license>
 7
 8#if NET6_0_OR_GREATER
 9
 10using System.Diagnostics.CodeAnalysis;
 11using System.Globalization;
 12using System.Text;
 13
 14#if NET9_0_OR_GREATER
 15using SpanSplitEnumerator = System.MemoryExtensions.SpanSplitEnumerator<char>;
 16#else
 17using SpanSplitEnumerator = Polyfills.Polyfill.SpanSplitEnumerator<char>;
 18#endif
 19
 20namespace JeremyAnsel.Media.WavefrontObj
 21{
 22    internal static class ObjMaterialFileReader9
 23    {
 24        private static void MoveNextSkipEmpty(ref SpanSplitEnumerator values)
 25        {
 639626            while (values.MoveNext())
 27            {
 637528                if (values.Current.Start.Value != values.Current.End.Value)
 29                {
 605130                    return;
 31                }
 32            }
 2133        }
 34
 35        private static ReadOnlySpan<char> GetNextValue(ref ReadOnlySpan<char> currentLine, ref SpanSplitEnumerator value
 36        {
 360637            MoveNextSkipEmpty(ref values);
 360638            return currentLine[values.Current];
 39        }
 40
 41        private static bool TryFloatParse(ReadOnlySpan<char> s, out float value)
 42        {
 62443            return float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out value);
 44        }
 45
 46        private static bool TryIntParse(ReadOnlySpan<char> s, out int value)
 47        {
 2148            return int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out value);
 49        }
 50
 51        [SuppressMessage("Globalization", "CA1303:Ne pas passer de littéraux en paramètres localisés", Justification = "
 52        public static ObjMaterialFile FromStream(Stream? stream, ObjMaterialFileReaderSettings settings)
 53        {
 129954            if (stream == null)
 55            {
 356                throw new ArgumentNullException(nameof(stream));
 57            }
 58
 129659            var mtl = new ObjMaterialFile();
 129660            var lineReader = new LineReader9();
 61
 129662            ObjMaterial? currentMaterial = null;
 63
 129664            int valueBufferSize = 16;
 129665            Span<char> valueBuffer = stackalloc char[valueBufferSize];
 66
 709567            foreach (var currentLineString in lineReader.Read9(stream))
 68            {
 246669                ReadOnlySpan<char> currentLine = currentLineString.Buffer.AsSpan()[..currentLineString.Length];
 70
 246671                int valuesCount = 0;
 72
 1885873                foreach (Range range in currentLine.SplitAny(LineReader9.LineSeparators))
 74                {
 696375                    if (currentLine[range].Length == 0)
 76                    {
 77                        continue;
 78                    }
 79
 638780                    valuesCount++;
 81                }
 82
 246683                SpanSplitEnumerator values = currentLine.SplitAny(LineReader9.LineSeparators);
 84
 246685                MoveNextSkipEmpty(ref values);
 86
 246687                if (values.Current.End.Value - values.Current.Start.Value > valueBufferSize)
 88                {
 89                    continue;
 90                }
 91
 246392                ReadOnlySpan<char> value0 = currentLine[values.Current];
 246393                int value0Length = value0.ToLowerInvariant(valueBuffer);
 94
 95                //if (value0Length == -1)
 96                //{
 97                //    throw new InvalidDataException("the buffer is too small");
 98                //}
 99
 2463100                switch (valueBuffer[..value0Length])
 101                {
 102                    case "newmtl":
 103                        {
 1191104                            if (valuesCount < 2)
 105                            {
 3106                                throw new InvalidDataException("A newmtl statement must specify a name.");
 107                            }
 108
 1188109                            var sb = new StringBuilder();
 110
 1188111                            sb.Append(GetNextValue(ref currentLine, ref values));
 112
 2394113                            for (int i = 2; i < valuesCount; i++)
 114                            {
 9115                                sb.Append(' ');
 9116                                sb.Append(GetNextValue(ref currentLine, ref values));
 117                            }
 118
 1188119                            currentMaterial = new ObjMaterial
 1188120                            {
 1188121                                Name = sb.ToString()
 1188122                            };
 123
 1188124                            mtl.Materials.Add(currentMaterial);
 125
 1188126                            break;
 127                        }
 128
 129                    case "ka":
 45130                        if (currentMaterial == null)
 131                        {
 3132                            throw new InvalidDataException("The material name is not specified.");
 133                        }
 134
 42135                        currentMaterial.AmbientColor = ParseMaterialColor("Ka", value0, ref currentLine, ref values, val
 24136                        break;
 137
 138                    case "kd":
 45139                        if (currentMaterial == null)
 140                        {
 3141                            throw new InvalidDataException("The material name is not specified.");
 142                        }
 143
 42144                        currentMaterial.DiffuseColor = ParseMaterialColor("Kd", value0, ref currentLine, ref values, val
 24145                        break;
 146
 147                    case "ke":
 45148                        if (currentMaterial == null)
 149                        {
 3150                            throw new InvalidDataException("The material name is not specified.");
 151                        }
 152
 42153                        currentMaterial.EmissiveColor = ParseMaterialColor("Ke", value0, ref currentLine, ref values, va
 24154                        break;
 155
 156                    case "ks":
 45157                        if (currentMaterial == null)
 158                        {
 3159                            throw new InvalidDataException("The material name is not specified.");
 160                        }
 161
 42162                        currentMaterial.SpecularColor = ParseMaterialColor("Ks", value0, ref currentLine, ref values, va
 24163                        break;
 164
 165                    case "tf":
 45166                        if (currentMaterial == null)
 167                        {
 3168                            throw new InvalidDataException("The material name is not specified.");
 169                        }
 170
 42171                        currentMaterial.TransmissionColor = ParseMaterialColor("Tf", value0, ref currentLine, ref values
 24172                        break;
 173
 174                    case "illum":
 175                    {
 12176                        if (currentMaterial == null)
 177                        {
 3178                            throw new InvalidDataException("The material name is not specified.");
 179                        }
 180
 9181                        if (valuesCount < 2)
 182                        {
 3183                            throw new InvalidDataException("An illum statement must specify an illumination model.");
 184                        }
 185
 6186                        if (valuesCount != 2)
 187                        {
 3188                            throw new InvalidDataException("An illum statement has too many values.");
 189                        }
 190
 3191                        if (TryIntParse(GetNextValue(ref currentLine, ref values), out var value))
 192                        {
 3193                            currentMaterial.IlluminationModel = value;
 194                        }
 195
 3196                        break;
 197                    }
 198                    case "d":
 199                        {
 21200                            if (currentMaterial == null)
 201                            {
 3202                                throw new InvalidDataException("The material name is not specified.");
 203                            }
 204
 18205                            if (valuesCount < 2)
 206                            {
 3207                                throw new InvalidDataException("A d statement must specify a factor.");
 208                            }
 209
 15210                            var value1 = GetNextValue(ref currentLine, ref values);
 211
 15212                            if (value1.Equals("-halo", StringComparison.OrdinalIgnoreCase))
 213                            {
 9214                                if (valuesCount < 3)
 215                                {
 3216                                    throw new InvalidDataException("A d statement must specify a factor.");
 217                                }
 218
 6219                                if (valuesCount != 3)
 220                                {
 3221                                    throw new InvalidDataException("A d statement has too many values.");
 222                                }
 223
 3224                                currentMaterial.IsHaloDissolve = true;
 3225                                if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 226                                {
 3227                                    currentMaterial.DissolveFactor = value;
 228                                }
 229                            }
 230                            else
 231                            {
 6232                                if (valuesCount != 2)
 233                                {
 3234                                    throw new InvalidDataException("A d statement has too many values.");
 235                                }
 236
 3237                                if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 238                                {
 3239                                    currentMaterial.DissolveFactor = value;
 240                                }
 241                            }
 242
 3243                            break;
 244                        }
 245
 246                    case "ns":
 247                    {
 12248                        if (currentMaterial == null)
 249                        {
 3250                            throw new InvalidDataException("The material name is not specified.");
 251                        }
 252
 9253                        if (valuesCount < 2)
 254                        {
 3255                            throw new InvalidDataException("A Ns statement must specify a specular exponent.");
 256                        }
 257
 6258                        if (valuesCount != 2)
 259                        {
 3260                            throw new InvalidDataException("A Ns statement has too many values.");
 261                        }
 262
 3263                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 264                        {
 3265                            currentMaterial.SpecularExponent = value;
 266                        }
 3267                        break;
 268                    }
 269                    case "sharpness":
 270                    {
 12271                        if (currentMaterial == null)
 272                        {
 3273                            throw new InvalidDataException("The material name is not specified.");
 274                        }
 275
 9276                        if (valuesCount < 2)
 277                        {
 3278                            throw new InvalidDataException("A sharpness statement must specify a sharpness value.");
 279                        }
 280
 6281                        if (valuesCount != 2)
 282                        {
 3283                            throw new InvalidDataException("A sharpness statement has too many values.");
 284                        }
 3285                        if (TryIntParse(GetNextValue(ref currentLine, ref values), out var value))
 286                        {
 3287                            currentMaterial.Sharpness = value;
 288                        }
 3289                        break;
 290                    }
 291                    case "ni":
 292                    {
 12293                        if (currentMaterial == null)
 294                        {
 3295                            throw new InvalidDataException("The material name is not specified.");
 296                        }
 297
 9298                        if (valuesCount < 2)
 299                        {
 3300                            throw new InvalidDataException("A Ni statement must specify an optical density.");
 301                        }
 302
 6303                        if (valuesCount != 2)
 304                        {
 3305                            throw new InvalidDataException("A Ni statement has too many values.");
 306                        }
 307
 3308                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 309                        {
 3310                            currentMaterial.OpticalDensity = value;
 311                        }
 312
 3313                        break;
 314                    }
 315                    case "map_aat":
 316                        {
 18317                            if (currentMaterial == null)
 318                            {
 3319                                throw new InvalidDataException("The material name is not specified.");
 320                            }
 321
 15322                            if (valuesCount < 2)
 323                            {
 3324                                throw new InvalidDataException("A map_aat statement must specify a value.");
 325                            }
 326
 12327                            if (valuesCount != 2)
 328                            {
 3329                                throw new InvalidDataException("A map_aat statement has too many values.");
 330                            }
 331
 9332                            var value1 = GetNextValue(ref currentLine, ref values);
 333
 9334                            if (value1.Equals("on", StringComparison.OrdinalIgnoreCase))
 335                            {
 3336                                currentMaterial.IsAntiAliasingEnabled = true;
 337                            }
 6338                            else if (value1.Equals("off", StringComparison.OrdinalIgnoreCase))
 339                            {
 3340                                currentMaterial.IsAntiAliasingEnabled = false;
 341                            }
 342                            else
 343                            {
 3344                                throw new InvalidDataException("A map_aat statement must specify on or off.");
 345                            }
 346
 347                            break;
 348                        }
 349
 350                    case "map_ka":
 396351                        if (currentMaterial == null)
 352                        {
 3353                            throw new InvalidDataException("The material name is not specified.");
 354                        }
 355
 393356                        currentMaterial.AmbientMap = ParseMaterialMap("map_Ka", value0, ref currentLine, ref values, val
 291357                        break;
 358
 359                    case "map_kd":
 39360                        if (currentMaterial == null)
 361                        {
 3362                            throw new InvalidDataException("The material name is not specified.");
 363                        }
 364
 36365                        currentMaterial.DiffuseMap = ParseMaterialMap("map_Kd", value0, ref currentLine, ref values, val
 33366                        break;
 367
 368                    case "map_ke":
 39369                        if (currentMaterial == null)
 370                        {
 3371                            throw new InvalidDataException("The material name is not specified.");
 372                        }
 373
 36374                        currentMaterial.EmissiveMap = ParseMaterialMap("map_Ke", value0, ref currentLine, ref values, va
 33375                        break;
 376
 377                    case "map_ks":
 39378                        if (currentMaterial == null)
 379                        {
 3380                            throw new InvalidDataException("The material name is not specified.");
 381                        }
 382
 36383                        currentMaterial.SpecularMap = ParseMaterialMap("map_Ks", value0, ref currentLine, ref values, va
 33384                        break;
 385
 386                    case "map_ns":
 39387                        if (currentMaterial == null)
 388                        {
 3389                            throw new InvalidDataException("The material name is not specified.");
 390                        }
 391
 36392                        currentMaterial.SpecularExponentMap = ParseMaterialMap("map_Ns", value0, ref currentLine, ref va
 33393                        break;
 394
 395                    case "map_d":
 396                    case "map_tr":
 39397                        if (currentMaterial == null)
 398                        {
 3399                            throw new InvalidDataException("The material name is not specified.");
 400                        }
 401
 36402                        currentMaterial.DissolveMap = ParseMaterialMap("map_d", value0, ref currentLine, ref values, val
 33403                        break;
 404
 405                    case "decal":
 406                    case "map_decal":
 15407                        if (currentMaterial == null)
 408                        {
 3409                            throw new InvalidDataException("The material name is not specified.");
 410                        }
 411
 12412                        currentMaterial.DecalMap = ParseMaterialMap("decal", value0, ref currentLine, ref values, values
 9413                        break;
 414
 415                    case "disp":
 416                    case "map_disp":
 15417                        if (currentMaterial == null)
 418                        {
 3419                            throw new InvalidDataException("The material name is not specified.");
 420                        }
 421
 12422                        currentMaterial.DispMap = ParseMaterialMap("disp", value0, ref currentLine, ref values, valuesCo
 9423                        break;
 424
 425                    case "bump":
 426                    case "map_bump":
 9427                        if (currentMaterial == null)
 428                        {
 3429                            throw new InvalidDataException("The material name is not specified.");
 430                        }
 431
 6432                        currentMaterial.BumpMap = ParseMaterialMap("bump", value0, ref currentLine, ref values, valuesCo
 3433                        break;
 434
 435                    case "refl":
 436                    case "map_refl":
 84437                        if (currentMaterial == null)
 438                        {
 3439                            throw new InvalidDataException("The material name is not specified.");
 440                        }
 441
 81442                        if (valuesCount < 4)
 443                        {
 12444                            throw new InvalidDataException("A refl statement must specify a type and a file name.");
 445                        }
 446
 69447                        ObjMaterialMap materialMap = ParseMaterialMap("refl", value0, ref currentLine, ref values, value
 448
 449                        switch (materialMapType)
 450                        {
 451                            case MaterialMapType.Sphere:
 9452                                currentMaterial.ReflectionMap.Sphere = materialMap;
 9453                                break;
 454
 455                            case MaterialMapType.CubeTop:
 9456                                currentMaterial.ReflectionMap.CubeTop = materialMap;
 9457                                break;
 458
 459                            case MaterialMapType.CubeBottom:
 9460                                currentMaterial.ReflectionMap.CubeBottom = materialMap;
 9461                                break;
 462
 463                            case MaterialMapType.CubeFront:
 9464                                currentMaterial.ReflectionMap.CubeFront = materialMap;
 9465                                break;
 466
 467                            case MaterialMapType.CubeBack:
 9468                                currentMaterial.ReflectionMap.CubeBack = materialMap;
 9469                                break;
 470
 471                            case MaterialMapType.CubeLeft:
 9472                                currentMaterial.ReflectionMap.CubeLeft = materialMap;
 9473                                break;
 474
 475                            case MaterialMapType.CubeRight:
 9476                                currentMaterial.ReflectionMap.CubeRight = materialMap;
 9477                                break;
 478                        }
 479
 480                        break;
 481                    case "pr":
 482                    {
 12483                        if (currentMaterial == null)
 484                        {
 3485                            throw new InvalidDataException("The material name is not specified.");
 486                        }
 487
 9488                        if (valuesCount < 2)
 489                        {
 3490                            throw new InvalidDataException("A Pr statement must specify an optical density.");
 491                        }
 492
 6493                        if (valuesCount != 2)
 494                        {
 3495                            throw new InvalidDataException("A Pr statement has too many values.");
 496                        }
 497
 3498                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 499                        {
 3500                            currentMaterial.Roughness = value;
 501                        }
 502
 3503                        break;
 504                    }
 505                    case "map_pr":
 39506                        if (currentMaterial == null)
 507                        {
 3508                            throw new InvalidDataException("The material name is not specified.");
 509                        }
 510
 36511                        currentMaterial.RoughnessMap = ParseMaterialMap("map_Pr", value0, ref currentLine, ref values, v
 33512                        break;
 513                    case "pm":
 514                    {
 12515                        if (currentMaterial == null)
 516                        {
 3517                            throw new InvalidDataException("The material name is not specified.");
 518                        }
 519
 9520                        if (valuesCount < 2)
 521                        {
 3522                            throw new InvalidDataException("A Pm statement must specify an optical density.");
 523                        }
 524
 6525                        if (valuesCount != 2)
 526                        {
 3527                            throw new InvalidDataException("A Pm statement has too many values.");
 528                        }
 529
 3530                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 531                        {
 3532                            currentMaterial.Metallic = value;
 533                        }
 3534                        break;
 535                    }
 536                    case "map_pm":
 39537                        if (currentMaterial == null)
 538                        {
 3539                            throw new InvalidDataException("The material name is not specified.");
 540                        }
 541
 36542                        currentMaterial.MetallicMap = ParseMaterialMap("map_Pm", value0, ref currentLine, ref values, va
 33543                        break;
 544                    case "ps":
 545                    {
 12546                        if (currentMaterial == null)
 547                        {
 3548                            throw new InvalidDataException("The material name is not specified.");
 549                        }
 550
 9551                        if (valuesCount < 2)
 552                        {
 3553                            throw new InvalidDataException("A Ps statement must specify an optical density.");
 554                        }
 555
 6556                        if (valuesCount != 2)
 557                        {
 3558                            throw new InvalidDataException("A Ps statement has too many values.");
 559                        }
 560
 3561                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 562                        {
 3563                            currentMaterial.Sheen = value;
 564                        }
 3565                        break;
 566                    }
 567                    case "map_ps":
 39568                        if (currentMaterial == null)
 569                        {
 3570                            throw new InvalidDataException("The material name is not specified.");
 571                        }
 572
 36573                        currentMaterial.SheenMap = ParseMaterialMap("map_Ps", value0, ref currentLine, ref values, value
 33574                        break;
 575                    case "pc":
 576                    {
 12577                        if (currentMaterial == null)
 578                        {
 3579                            throw new InvalidDataException("The material name is not specified.");
 580                        }
 581
 9582                        if (valuesCount < 2)
 583                        {
 3584                            throw new InvalidDataException("A Pc statement must specify an optical density.");
 585                        }
 586
 6587                        if (valuesCount != 2)
 588                        {
 3589                            throw new InvalidDataException("A Pc statement has too many values.");
 590                        }
 591
 3592                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 593                        {
 3594                            currentMaterial.ClearCoatThickness = value;
 595                        }
 3596                        break;
 597                    }
 598                    case "pcr":
 599                    {
 12600                        if (currentMaterial == null)
 601                        {
 3602                            throw new InvalidDataException("The material name is not specified.");
 603                        }
 604
 9605                        if (valuesCount < 2)
 606                        {
 3607                            throw new InvalidDataException("A Pcr statement must specify an optical density.");
 608                        }
 609
 6610                        if (valuesCount != 2)
 611                        {
 3612                            throw new InvalidDataException("A Pcr statement has too many values.");
 613                        }
 614
 3615                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 616                        {
 3617                            currentMaterial.ClearCoatRoughness = value;
 618                        }
 3619                        break;
 620                    }
 621                    case "aniso":
 622                    {
 12623                        if (currentMaterial == null)
 624                        {
 3625                            throw new InvalidDataException("The material name is not specified.");
 626                        }
 627
 9628                        if (valuesCount < 2)
 629                        {
 3630                            throw new InvalidDataException("A aniso statement must specify an optical density.");
 631                        }
 632
 6633                        if (valuesCount != 2)
 634                        {
 3635                            throw new InvalidDataException("A aniso statement has too many values.");
 636                        }
 637
 3638                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 639                        {
 3640                            currentMaterial.Anisotropy = value;
 641                        }
 642
 3643                        break;
 644                    }
 645                    case "anisor":
 646                    {
 12647                        if (currentMaterial == null)
 648                        {
 3649                            throw new InvalidDataException("The material name is not specified.");
 650                        }
 651
 9652                        if (valuesCount < 2)
 653                        {
 3654                            throw new InvalidDataException("A anisor statement must specify an optical density.");
 655                        }
 656
 6657                        if (valuesCount != 2)
 658                        {
 3659                            throw new InvalidDataException("A anisor statement has too many values.");
 660                        }
 661
 3662                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 663                        {
 3664                            currentMaterial.AnisotropyRotation = value;
 665                        }
 3666                        break;
 667                    }
 668                    case "norm":
 39669                        if (currentMaterial == null)
 670                        {
 3671                            throw new InvalidDataException("The material name is not specified.");
 672                        }
 673
 36674                        currentMaterial.Norm = ParseMaterialMap("norm", value0, ref currentLine, ref values, valuesCount
 675                        break;
 676                }
 677            }
 678
 867679            mtl.HeaderText = string.Join("\n", lineReader.HeaderTextLines.ToArray());
 680
 867681            return mtl;
 682        }
 683
 684        [SuppressMessage("Globalization", "CA1303:Ne pas passer de littéraux en paramètres localisés", Justification = "
 685        private static ObjMaterialColor ParseMaterialColor(ReadOnlySpan<char> statement, ReadOnlySpan<char> value0, ref 
 686        {
 210687            if (valuesCount < 2)
 688            {
 15689                throw new InvalidDataException(string.Concat("A ", statement, " statement must specify a color."));
 690            }
 691
 195692            var color = new ObjMaterialColor();
 693
 195694            ReadOnlySpan<char> value1 = GetNextValue(ref currentLine, ref values);
 195695            Span<char> valueBuffer = stackalloc char[value1.Length];
 195696            int value1Length = value1.ToLowerInvariant(valueBuffer);
 697
 698            //if (value1Length == -1)
 699            //{
 700            //    throw new InvalidDataException("the buffer is too small");
 701            //}
 702
 195703            int index = 1;
 704
 195705            switch (valueBuffer[..value1Length])
 706            {
 707                case "spectral":
 708                {
 60709                    index++;
 710
 60711                    if (valuesCount - index < 1)
 712                    {
 15713                        throw new InvalidDataException(string.Concat("A ", statement,
 15714                            " spectral statement must specify a file name."));
 715                    }
 716
 45717                    color.SpectralFileName = GetNextValue(ref currentLine, ref values).ToString();
 45718                    index++;
 719
 45720                    if (valuesCount > index)
 721                    {
 30722                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 723                        {
 30724                            color.SpectralFactor = value;
 725                        }
 726
 30727                        index++;
 728                    }
 729
 30730                    break;
 731                }
 732                case "xyz":
 733                {
 60734                    index++;
 735
 60736                    if (valuesCount - index < 1)
 737                    {
 15738                        throw new InvalidDataException(string.Concat("A ", statement,
 15739                            " xyz statement must specify a color."));
 740                    }
 741
 45742                    color.UseXYZColorSpace = true;
 743
 45744                    var xyz = new ObjVector3();
 45745                    if (TryFloatParse(GetNextValue(ref currentLine, ref values), out var value))
 746                    {
 45747                        xyz.X = value;
 748                    }
 749
 45750                    index++;
 751
 45752                    if (valuesCount > index)
 753                    {
 30754                        if (valuesCount - index < 2)
 755                        {
 15756                            throw new InvalidDataException(string.Concat("A ", statement,
 15757                                " xyz statement must specify a XYZ color."));
 758                        }
 759
 15760                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out value))
 761                        {
 15762                            xyz.Y = value;
 763                        }
 764
 15765                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out value))
 766                        {
 15767                            xyz.Z = value;
 768                        }
 769
 15770                        index += 2;
 771                    }
 772                    else
 773                    {
 15774                        xyz.Y = xyz.X;
 15775                        xyz.Z = xyz.X;
 776                    }
 777
 30778                    color.Color = xyz;
 30779                    break;
 780                }
 781                default:
 782                {
 75783                    var rgb = new ObjVector3();
 75784                    if (TryFloatParse(value1, out var value))
 785                    {
 75786                        rgb.X = value;
 787                    }
 788
 75789                    index++;
 790
 75791                    if (valuesCount > index)
 792                    {
 60793                        if (valuesCount - index < 2)
 794                        {
 15795                            throw new InvalidDataException(string.Concat("A ", statement,
 15796                                " statement must specify a RGB color."));
 797                        }
 798
 45799                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out value))
 800                        {
 45801                            rgb.Y = value;
 802                        }
 803
 45804                        if (TryFloatParse(GetNextValue(ref currentLine, ref values), out value))
 805                        {
 45806                            rgb.Z = value;
 807                        }
 808
 45809                        index += 2;
 810                    }
 811                    else
 812                    {
 15813                        rgb.Y = rgb.X;
 15814                        rgb.Z = rgb.X;
 815                    }
 816
 60817                    color.Color = rgb;
 818                    break;
 819                }
 820            }
 821
 135822            if (index != valuesCount)
 823            {
 15824                throw new InvalidDataException(string.Concat("A ", statement, " statement has too many values."));
 825            }
 826
 120827            return color;
 828        }
 829
 830        private enum MaterialMapType
 831        {
 832            None,
 833            Sphere,
 834            CubeTop,
 835            CubeBottom,
 836            CubeFront,
 837            CubeBack,
 838            CubeLeft,
 839            CubeRight
 840        }
 841
 842        [SuppressMessage("Globalization", "CA1303:Ne pas passer de littéraux en paramètres localisés", Justification = "
 843        private static ObjMaterialMap ParseMaterialMap(ReadOnlySpan<char> statement, ReadOnlySpan<char> value0, ref Read
 844        {
 747845            return ParseMaterialMap(statement, value0, ref currentLine, ref values, valuesCount, settings, out _);
 846        }
 847
 848        [SuppressMessage("Globalization", "CA1303:Ne pas passer de littéraux en paramètres localisés", Justification = "
 849        private static ObjMaterialMap ParseMaterialMap(ReadOnlySpan<char> statement, ReadOnlySpan<char> value0, ref Read
 850        {
 816851            materialMapType = MaterialMapType.None;
 852
 816853            var map = new ObjMaterialMap();
 816854            var charsRead = 0;
 855
 816856            int valueBufferSize = 16;
 816857            Span<char> valueBuffer = stackalloc char[valueBufferSize];
 858
 2535859            for (int index = 0; index < valuesCount;)
 860            {
 1164861                index++;
 862
 1164863                if (valuesCount - index < 1)
 864                {
 66865                    throw new InvalidDataException(string.Concat("A ", statement, " statement must specify a filename.")
 866                }
 867
 1098868                ReadOnlySpan<char> value1 = GetNextValue(ref currentLine, ref values);
 1098869                int value1Length = value1.ToLowerInvariant(valueBuffer);
 870
 871                // Value1Length is -1 when the buffer is too small.
 872                // This should only happen if the value is a file name and not an option
 1098873                if (value1Length == -1)
 874                {
 120875                    if (index == 1)
 876                    {
 120877                        if (statement.Equals("refl", StringComparison.OrdinalIgnoreCase))
 878                        {
 0879                            throw new InvalidDataException("A refl statement must specify a type.");
 880                        }
 881                    }
 120882                    if (settings.KeepWhitespacesOfMapFileReferences)
 883                    {
 30884                        map.FileName = new string(currentLine[(statement.Length + charsRead + 1)..]);
 885                    }
 886                    else
 887                    {
 90888                        var sb = new StringBuilder();
 889
 90890                        sb.Append(value1);
 891
 300892                        for (int i = index + 1; i < valuesCount; i++)
 893                        {
 60894                            sb.Append(' ');
 60895                            sb.Append(GetNextValue(ref currentLine, ref values));
 896                        }
 897
 90898                        string filename = sb.ToString();
 899
 90900                        map.FileName = filename;
 901                    }
 902
 120903                    return map;
 904                }
 905
 978906                charsRead += value1Length;
 907
 978908                if (statement.Equals("refl", StringComparison.OrdinalIgnoreCase))
 909                {
 135910                    if (index == 1)
 911                    {
 69912                        if (!MemoryExtensions.Equals(valueBuffer[..value1Length], "-type", StringComparison.OrdinalIgnor
 913                        {
 3914                            throw new InvalidDataException("A refl statement must specify a type.");
 915                        }
 916                    }
 917                }
 918
 975919                switch (valueBuffer[..value1Length])
 920                {
 921                    case "-type":
 72922                        if (valuesCount - index < 2)
 923                        {
 3924                            throw new InvalidDataException(string.Concat("A ", statement, " -type option must specify a 
 925                        }
 926
 69927                        if (statement.Equals("refl", StringComparison.OrdinalIgnoreCase))
 928                        {
 66929                            ReadOnlySpan<char> value2 = GetNextValue(ref currentLine, ref values);
 66930                            int value2Length = value2.ToLowerInvariant(valueBuffer);
 66931                            charsRead += value2Length;
 932
 933                            //if (value2Length == -1)
 934                            //{
 935                            //    throw new InvalidDataException("the buffer is too small");
 936                            //}
 937
 66938                            switch (valueBuffer[..value2Length])
 939                            {
 940                                case "sphere":
 9941                                    materialMapType = MaterialMapType.Sphere;
 9942                                    break;
 943
 944                                case "cube_top":
 9945                                    materialMapType = MaterialMapType.CubeTop;
 9946                                    break;
 947
 948                                case "cube_bottom":
 9949                                    materialMapType = MaterialMapType.CubeBottom;
 9950                                    break;
 951
 952                                case "cube_front":
 9953                                    materialMapType = MaterialMapType.CubeFront;
 9954                                    break;
 955
 956                                case "cube_back":
 9957                                    materialMapType = MaterialMapType.CubeBack;
 9958                                    break;
 959
 960                                case "cube_left":
 9961                                    materialMapType = MaterialMapType.CubeLeft;
 9962                                    break;
 963
 964                                case "cube_right":
 9965                                    materialMapType = MaterialMapType.CubeRight;
 9966                                    break;
 967                            }
 968                        }
 969                        else
 970                        {
 3971                            GetNextValue(ref currentLine, ref values);
 972                        }
 973
 69974                        index++;
 69975                        break;
 976
 977                    case "-blenu":
 978                        {
 21979                            if (valuesCount - index < 2)
 980                            {
 3981                                throw new InvalidDataException(string.Concat("A ", statement, " -blenu option must speci
 982                            }
 983
 18984                            var value2 = GetNextValue(ref currentLine, ref values);
 18985                            charsRead += value2.Length;
 986
 18987                            if (value2.Equals("on", StringComparison.OrdinalIgnoreCase))
 988                            {
 6989                                map.IsHorizontalBlendingEnabled = true;
 990                            }
 12991                            else if (value2.Equals("off", StringComparison.OrdinalIgnoreCase))
 992                            {
 6993                                map.IsHorizontalBlendingEnabled = false;
 994                            }
 995                            else
 996                            {
 6997                                throw new InvalidDataException(string.Concat("A ", statement, " -blenu option must speci
 998                            }
 999
 121000                            index++;
 121001                            break;
 1002                        }
 1003
 1004                    case "-blenv":
 1005                        {
 211006                            if (valuesCount - index < 2)
 1007                            {
 31008                                throw new InvalidDataException(string.Concat("A ", statement, " -blenv option must speci
 1009                            }
 1010
 181011                            var value2 = GetNextValue(ref currentLine, ref values);
 181012                            charsRead += value2.Length;
 1013
 181014                            if (value2.Equals("on", StringComparison.OrdinalIgnoreCase))
 1015                            {
 61016                                map.IsVerticalBlendingEnabled = true;
 1017                            }
 121018                            else if (value2.Equals("off", StringComparison.OrdinalIgnoreCase))
 1019                            {
 61020                                map.IsVerticalBlendingEnabled = false;
 1021                            }
 1022                            else
 1023                            {
 61024                                throw new InvalidDataException(string.Concat("A ", statement, " -blenv option must speci
 1025                            }
 1026
 121027                            index++;
 121028                            break;
 1029                        }
 1030
 1031                    case "-bm":
 1032                    {
 181033                        if (valuesCount - index < 2)
 1034                        {
 31035                            throw new InvalidDataException(string.Concat("A ", statement, " -bm option must specify a va
 1036                        }
 1037
 151038                        var value2 = GetNextValue(ref currentLine, ref values);
 151039                        charsRead += value2.Length;
 1040
 151041                        if (TryFloatParse(value2, out var value))
 1042                        {
 151043                            map.BumpMultiplier = value;
 1044                        }
 1045
 151046                        index++;
 151047                        break;
 1048                    }
 1049                    case "-boost":
 1050                    {
 181051                        if (valuesCount - index < 2)
 1052                        {
 31053                            throw new InvalidDataException(string.Concat("A ", statement,
 31054                                " -boost option must specify a value."));
 1055                        }
 1056
 151057                        var value2 = GetNextValue(ref currentLine, ref values);
 151058                        charsRead += value2.Length;
 1059
 151060                        if (TryFloatParse(value2, out var value))
 1061                        {
 151062                            map.Boost = value;
 1063                        }
 1064
 151065                        index++;
 151066                        break;
 1067                    }
 1068                    case "-cc":
 1069                        {
 211070                            if (valuesCount - index < 2)
 1071                            {
 31072                                throw new InvalidDataException(string.Concat("A ", statement, " -cc option must specify 
 1073                            }
 1074
 181075                            var value2 = GetNextValue(ref currentLine, ref values);
 181076                            charsRead += value2.Length;
 1077
 181078                            if (value2.Equals("on", StringComparison.OrdinalIgnoreCase))
 1079                            {
 61080                                map.IsColorCorrectionEnabled = true;
 1081                            }
 121082                            else if (value2.Equals("off", StringComparison.OrdinalIgnoreCase))
 1083                            {
 61084                                map.IsColorCorrectionEnabled = false;
 1085                            }
 1086                            else
 1087                            {
 61088                                throw new InvalidDataException(string.Concat("A ", statement, " -cc option must specify 
 1089                            }
 1090
 121091                            index++;
 121092                            break;
 1093                        }
 1094
 1095                    case "-clamp":
 1096                        {
 211097                            if (valuesCount - index < 2)
 1098                            {
 31099                                throw new InvalidDataException(string.Concat("A ", statement, " -clamp option must speci
 1100                            }
 1101
 181102                            var value2 = GetNextValue(ref currentLine, ref values);
 181103                            charsRead += value2.Length;
 1104
 181105                            if (value2.Equals("on", StringComparison.OrdinalIgnoreCase))
 1106                            {
 61107                                map.IsClampingEnabled = true;
 1108                            }
 121109                            else if (value2.Equals("off", StringComparison.OrdinalIgnoreCase))
 1110                            {
 61111                                map.IsClampingEnabled = false;
 1112                            }
 1113                            else
 1114                            {
 61115                                throw new InvalidDataException(string.Concat("A ", statement, " -clamp option must speci
 1116                            }
 1117
 121118                            index++;
 121119                            break;
 1120                        }
 1121
 1122                    case "-imfchan":
 1123                        {
 631124                            if (valuesCount - index < 2)
 1125                            {
 31126                                throw new InvalidDataException(string.Concat("A ", statement, " -imfchan option must spe
 1127                            }
 1128
 601129                            ReadOnlySpan<char> value2 = GetNextValue(ref currentLine, ref values);
 601130                            int value2Length = value2.ToLowerInvariant(valueBuffer);
 601131                            charsRead += value2Length;
 1132
 1133                            //if (value2Length == -1)
 1134                            //{
 1135                            //    throw new InvalidDataException("the buffer is too small");
 1136                            //}
 1137
 601138                            switch (valueBuffer[..value2Length])
 1139                            {
 1140                                case "r":
 91141                                    map.ScalarChannel = ObjMapChannel.Red;
 91142                                    break;
 1143
 1144                                case "g":
 91145                                    map.ScalarChannel = ObjMapChannel.Green;
 91146                                    break;
 1147
 1148                                case "b":
 91149                                    map.ScalarChannel = ObjMapChannel.Blue;
 91150                                    break;
 1151
 1152                                case "m":
 91153                                    map.ScalarChannel = ObjMapChannel.Matte;
 91154                                    break;
 1155
 1156                                case "l":
 91157                                    map.ScalarChannel = ObjMapChannel.Luminance;
 91158                                    break;
 1159
 1160                                case "z":
 91161                                    map.ScalarChannel = ObjMapChannel.Depth;
 91162                                    break;
 1163
 1164                                default:
 61165                                    throw new InvalidDataException(string.Concat("A ", statement, " -imfchan option must
 1166                            }
 1167
 541168                            index++;
 541169                            break;
 1170                        }
 1171
 1172                    case "-mm":
 1173                    {
 211174                        if (valuesCount - index < 3)
 1175                        {
 61176                            throw new InvalidDataException(string.Concat("A ", statement, " -mm option must specify a ba
 1177                        }
 1178
 151179                        var value2 = GetNextValue(ref currentLine, ref values);
 151180                        charsRead += value2.Length;
 1181
 151182                        if (TryFloatParse(value2, out var value))
 1183                        {
 151184                            map.ModifierBase = value;
 1185                        }
 151186                        value2 = GetNextValue(ref currentLine, ref values);
 151187                        charsRead += value2.Length;
 1188
 151189                        if (TryFloatParse(value2, out value))
 1190                        {
 151191                            map.ModifierGain = value;
 1192                        }
 1193
 151194                        index += 2;
 151195                        break;
 1196                    }
 1197
 1198
 1199                    case "-o":
 1200                    {
 421201                        if (valuesCount - index < 2)
 1202                        {
 31203                            throw new InvalidDataException(string.Concat("A ", statement,
 31204                                " -o option must specify at least 2 values."));
 1205                        }
 1206
 391207                        var offset = new ObjVector3();
 391208                        var value2 = GetNextValue(ref currentLine, ref values);
 1209
 391210                        if (TryFloatParse(value2, out var value))
 1211                        {
 391212                            offset.X = value;
 391213                            index++;
 391214                            charsRead += value2.Length;
 1215                        }
 1216                        else
 1217                        {
 01218                            map.Offset = offset;
 01219                            break;
 1220                        }
 1221
 391222                        if (valuesCount - index > 2)
 1223                        {
 301224                            value2 = GetNextValue(ref currentLine, ref values);
 301225                            if (TryFloatParse(value2, out value))
 1226                            {
 241227                                offset.Y = value;
 241228                                index++;
 241229                                charsRead += value2.Length;
 1230                            }
 1231                            else
 1232                            {
 61233                                map.Offset = offset;
 61234                                break;
 1235                            }
 1236
 241237                            if (valuesCount - index > 2)
 1238                            {
 181239                                value2 = GetNextValue(ref currentLine, ref values);
 181240                                if (TryFloatParse(value2, out value))
 1241                                {
 121242                                    offset.Z = value;
 121243                                    index++;
 121244                                    charsRead += value2.Length;
 1245                                }
 1246                                else
 1247                                {
 61248                                    map.Offset = offset;
 61249                                    break;
 1250                                }
 1251                            }
 1252                        }
 1253
 271254                        map.Offset = offset;
 271255                        break;
 1256                    }
 1257                    case "-s":
 1258                    {
 421259                        if (valuesCount - index < 2)
 1260                        {
 31261                            throw new InvalidDataException(string.Concat("A ", statement,
 31262                                " -s option must specify at least 2 values."));
 1263                        }
 1264
 391265                        var scale = new ObjVector3(1.0f, 1.0f, 1.0f);
 1266
 391267                        var value2 = GetNextValue(ref currentLine, ref values);
 1268
 391269                        if (TryFloatParse(value2, out var value))
 1270                        {
 391271                            scale.X = value;
 391272                            index++;
 391273                            charsRead += value2.Length;
 1274                        }
 1275                        else
 1276                        {
 01277                            map.Scale = scale;
 01278                            break;
 1279                        }
 1280
 391281                        if (valuesCount - index > 2)
 1282                        {
 301283                            value2 = GetNextValue(ref currentLine, ref values);
 301284                            if (TryFloatParse(value2, out value))
 1285                            {
 241286                                scale.Y = value;
 241287                                index++;
 241288                                charsRead += value2.Length;
 1289                            }
 1290                            else
 1291                            {
 61292                                map.Scale = scale;
 61293                                break;
 1294                            }
 1295
 241296                            if (valuesCount - index > 2)
 1297                            {
 181298                                value2 = GetNextValue(ref currentLine, ref values);
 181299                                if (TryFloatParse(value2, out value))
 1300                                {
 121301                                    scale.Z = value;
 121302                                    index++;
 121303                                    charsRead += value2.Length;
 1304                                }
 1305                                else
 1306                                {
 61307                                    map.Scale = scale;
 61308                                    break;
 1309                                }
 1310                            }
 1311                        }
 1312
 271313                        map.Scale = scale;
 271314                        break;
 1315                    }
 1316                    case "-t":
 1317                    {
 421318                        if (valuesCount - index < 2)
 1319                        {
 31320                            throw new InvalidDataException(string.Concat("A ", statement,
 31321                                " -t option must specify at least 2 values."));
 1322                        }
 1323
 391324                        var turbulence = new ObjVector3();
 1325
 391326                        var value2 = GetNextValue(ref currentLine, ref values);
 1327
 391328                        if (TryFloatParse(value2, out var value))
 1329                        {
 391330                            turbulence.X = value;
 391331                            index++;
 391332                            charsRead += value2.Length;
 1333                        }
 1334                        else
 1335                        {
 01336                            map.Turbulence = turbulence;
 01337                            break;
 1338                        }
 1339
 391340                        if (valuesCount - index > 2)
 1341                        {
 301342                            value2 = GetNextValue(ref currentLine, ref values);
 301343                            if (TryFloatParse(value2, out value))
 1344                            {
 241345                                turbulence.Y = value;
 241346                                index++;
 241347                                charsRead += value2.Length;
 1348                            }
 1349                            else
 1350                            {
 61351                                map.Turbulence = turbulence;
 61352                                break;
 1353                            }
 1354
 241355                            if (valuesCount - index > 2)
 1356                            {
 181357                                value2 = GetNextValue(ref currentLine, ref values);
 181358                                if (TryFloatParse(value2, out value))
 1359                                {
 121360                                    turbulence.Z = value;
 121361                                    index++;
 121362                                    charsRead += value2.Length;
 1363                                }
 1364                                else
 1365                                {
 61366                                    map.Turbulence = turbulence;
 61367                                    break;
 1368                                }
 1369                            }
 1370                        }
 1371
 271372                        map.Turbulence = turbulence;
 271373                        break;
 1374                    }
 1375                    case "-texres":
 1376                    {
 181377                        if (valuesCount - index < 2)
 1378                        {
 31379                            throw new InvalidDataException(string.Concat("A ", statement,
 31380                                " -texres option must specify a value."));
 1381                        }
 151382                        var value2 = GetNextValue(ref currentLine, ref values);
 151383                        charsRead += value2.Length;
 151384                        if (TryIntParse(value2, out var value))
 1385                        {
 151386                            map.TextureResolution = value;
 1387                        }
 1388
 151389                        index++;
 151390                        break;
 1391                    }
 1392                    default:
 1393                        {
 5551394                            if (settings.KeepWhitespacesOfMapFileReferences)
 1395                            {
 1801396                                map.FileName = new string(currentLine[(statement.Length + index + charsRead - value1.Len
 1397                            }
 1398                            else
 1399                            {
 3751400                                var sb = new StringBuilder();
 1401
 3751402                                sb.Append(value1);
 1403
 11821404                                for (int i = index + 1; i < valuesCount; i++)
 1405                                {
 2161406                                    sb.Append(' ');
 2161407                                    sb.Append(GetNextValue(ref currentLine, ref values));
 1408                                }
 1409
 3751410                                string filename = sb.ToString();
 1411
 3751412                                map.FileName = filename;
 1413                            }
 5551414                            index = valuesCount;
 1415
 1416                            break;
 1417                        }
 1418                }
 1419            }
 1420
 5551421            return map;
 1422        }
 1423    }
 1424}
 1425
 1426#endif
 1427

Methods/Properties

MoveNextSkipEmpty(Polyfills.Polyfill/SpanSplitEnumerator`1<System.Char>&)
MoveNextSkipEmpty(System.MemoryExtensions/SpanSplitEnumerator`1<System.Char>&)
GetNextValue(System.ReadOnlySpan`1<System.Char>&,Polyfills.Polyfill/SpanSplitEnumerator`1<System.Char>&)
GetNextValue(System.ReadOnlySpan`1<System.Char>&,System.MemoryExtensions/SpanSplitEnumerator`1<System.Char>&)
TryFloatParse(System.ReadOnlySpan`1<System.Char>,System.Single&)
TryIntParse(System.ReadOnlySpan`1<System.Char>,System.Int32&)
FromStream(System.IO.Stream,JeremyAnsel.Media.WavefrontObj.ObjMaterialFileReaderSettings)
ParseMaterialColor(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>&,Polyfills.Polyfill/SpanSplitEnumerator`1<System.Char>&,System.Int32)
ParseMaterialColor(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>&,System.MemoryExtensions/SpanSplitEnumerator`1<System.Char>&,System.Int32)
ParseMaterialMap(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>&,Polyfills.Polyfill/SpanSplitEnumerator`1<System.Char>&,System.Int32,JeremyAnsel.Media.WavefrontObj.ObjMaterialFileReaderSettings)
ParseMaterialMap(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>&,System.MemoryExtensions/SpanSplitEnumerator`1<System.Char>&,System.Int32,JeremyAnsel.Media.WavefrontObj.ObjMaterialFileReaderSettings)
ParseMaterialMap(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>&,Polyfills.Polyfill/SpanSplitEnumerator`1<System.Char>&,System.Int32,JeremyAnsel.Media.WavefrontObj.ObjMaterialFileReaderSettings,JeremyAnsel.Media.WavefrontObj.ObjMaterialFileReader9/MaterialMapType&)
ParseMaterialMap(System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>,System.ReadOnlySpan`1<System.Char>&,System.MemoryExtensions/SpanSplitEnumerator`1<System.Char>&,System.Int32,JeremyAnsel.Media.WavefrontObj.ObjMaterialFileReaderSettings,JeremyAnsel.Media.WavefrontObj.ObjMaterialFileReader9/MaterialMapType&)