Skip to content

Commit

Permalink
replace line with trimmedLine to do slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
EzioHelios committed Dec 19, 2023
1 parent 1909c8f commit 1e4328f
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Obj2Tiles/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ public static IEnumerable<string> GetObjDependencies(string objPath)

foreach (var line in objFile)
{
if (!line.StartsWith("mtllib")) continue;
var trimmedLine = line.Trim();

if (!trimmedLine.StartsWith("mtllib")) continue;

var mtlPath = Path.Combine(folderName, line[7..].Trim());
dependencies.Add(line[7..].Trim());
var mtlPath = Path.Combine(folderName, trimmedLine[7..].Trim());
dependencies.Add(trimmedLine[7..].Trim());

dependencies.AddRange(GetMtlDependencies(mtlPath));
}
Expand All @@ -42,70 +44,70 @@ private static IEnumerable<string> GetMtlDependencies(string mtlPath)

if (trimmedLine.StartsWith("map_Kd"))
{
dependencies.Add(line[7..].Trim());
dependencies.Add(trimmedLine[7..].Trim());

continue;
}

if (trimmedLine.StartsWith("map_Ka"))
{
dependencies.Add(line[7..].Trim());
dependencies.Add(trimmedLine[7..].Trim());

continue;
}

if (trimmedLine.StartsWith("norm"))
{
dependencies.Add(line[5..].Trim());
dependencies.Add(trimmedLine[5..].Trim());

continue;
}

if (trimmedLine.StartsWith("map_Ks"))
{
dependencies.Add(line[7..].Trim());
dependencies.Add(trimmedLine[7..].Trim());

continue;
}

if (trimmedLine.StartsWith("map_Bump"))
{
dependencies.Add(line[8..].Trim());
dependencies.Add(trimmedLine[8..].Trim());

continue;
}

if (trimmedLine.StartsWith("map_d"))
{
dependencies.Add(line[6..].Trim());
dependencies.Add(trimmedLine[6..].Trim());

continue;
}

if (trimmedLine.StartsWith("map_Ns"))
{
dependencies.Add(line[7..].Trim());
dependencies.Add(trimmedLine[7..]);

continue;
}

if (trimmedLine.StartsWith("bump"))
{
dependencies.Add(line[5..].Trim());
dependencies.Add(trimmedLine[5..].Trim());

continue;
}

if (trimmedLine.StartsWith("disp"))
{
dependencies.Add(line[5..].Trim());
dependencies.Add(trimmedLine[5..].Trim());

continue;
}

if (trimmedLine.StartsWith("decal"))
{
dependencies.Add(line[6..].Trim());
dependencies.Add(trimmedLine[6..].Trim());

continue;
}
Expand Down

0 comments on commit 1e4328f

Please sign in to comment.