Skip to content

Commit

Permalink
Merge pull request OpenDroneMap#17 from HeDo88TH/master
Browse files Browse the repository at this point in the history
Added texture coordinate range check
  • Loading branch information
HeDo88TH authored Aug 5, 2022
2 parents 1f6c065 + dd7af9b commit 6d38c63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions Obj2Tiles.Library/Geometry/MeshUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ public static IMesh LoadMesh(string fileName, out string[] dependencies)
double.Parse(segs[3], CultureInfo.InvariantCulture)));
break;
case "vt" when segs.Length >= 3:
textureVertices.Add(new Vertex2(

var vtx = new Vertex2(
double.Parse(segs[1], CultureInfo.InvariantCulture),
double.Parse(segs[2], CultureInfo.InvariantCulture)));
double.Parse(segs[2], CultureInfo.InvariantCulture));

if (vtx.X < 0 || vtx.Y < 0 || vtx.X > 1 || vtx.Y > 1)
throw new Exception("Invalid texture coordinates: " + vtx);

textureVertices.Add(vtx);
break;
case "vn" when segs.Length == 3:
// Skipping normals
Expand Down
4 changes: 2 additions & 2 deletions Obj2Tiles/Obj2Tiles.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<AssemblyVersion>1.0.8</AssemblyVersion>
<FileVersion>1.0.8</FileVersion>
<AssemblyVersion>1.0.9</AssemblyVersion>
<FileVersion>1.0.9</FileVersion>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>

Expand Down

0 comments on commit 6d38c63

Please sign in to comment.