Skip to content

Commit

Permalink
Added support for materials and textures with full paths
Browse files Browse the repository at this point in the history
  • Loading branch information
MGerdel committed Jul 19, 2023
1 parent 7cb737b commit 4df9552
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/L3D.Net/Geometry/ObjParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public IModel3D Parse(string filePath, ILogger? logger = null)
var filePaths = objMaterialLibraries.Select(x => x.Item1).Union(textures).ToList();
filePaths.Add(filePath);

var files = filePaths.ToDictionary<string, string, byte[]>(Path.GetFileName, d => File.ReadAllBytes(Path.Combine(directory, d)));
var files = filePaths.ToDictionary(GetFileName, d => File.ReadAllBytes(Path.Combine(directory, d)));

return new ObjModel3D
{
Expand Down Expand Up @@ -102,7 +102,7 @@ private static IEnumerable<Tuple<string, ObjMaterialFile>> CollectAvailableMater
{
try
{
mtl = Path.GetFileName(mtl);
mtl = GetFileName(mtl);
var materialFile = files[mtl];
materialFile.Seek(0, SeekOrigin.Begin);
return Tuple.Create(mtl, ObjMaterialFile.FromStream(materialFile));
Expand Down

0 comments on commit 4df9552

Please sign in to comment.