Skip to content

Commit a784939

Browse files
committed
work around lack of expand_faceview(::MetaMesh)
1 parent a6a8a58 commit a784939

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/io/obj.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ end
199199
function save(f::Stream{format"OBJ"}, mesh::AbstractMesh)
200200
# TODO: allow saving with faceviews (i.e. build the / or // syntax)
201201
if any(v -> v isa FaceView, values(vertex_attributes(mesh)))
202-
mesh = GeometryBasics.expand_faceviews(mesh)
202+
mesh = GeometryBasics.expand_faceviews(Mesh(mesh))
203203
end
204204

205205
io = stream(f)

test/runtests.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ end
166166
@test msh[:materials]["Material"]["ambient"] === Vec3f(0.0, 0.0, 0.0)
167167
end
168168

169-
msh = Mesh(load(joinpath(tf, "cube_uv.obj")))
169+
msh = load(joinpath(tf, "cube_uv.obj"))
170170
@test typeof(msh.uv) == Vector{Vec{2,Float32}}
171171
@test length(msh.uv) == 8
172172

173-
msh = Mesh(load(joinpath(tf, "cube_uvw.obj")))
173+
msh = load(joinpath(tf, "cube_uvw.obj"))
174174
@test typeof(msh.uv) == Vector{Vec{3,Float32}}
175175
@test length(msh.uv) == 8
176176

@@ -187,7 +187,7 @@ end
187187
@test normals(msh) isa FaceView
188188

189189
# test correctness of reordered vertices
190-
msh2 = expand_faceviews(msh)
190+
msh2 = expand_faceviews(Mesh(msh))
191191
@test !(normals(msh2) isa FaceView)
192192
@test length(faces(msh2)) == 1
193193
@test coordinates(coordinates(msh2)[faces(msh2)[1]]) == (Vec3f(0), Vec3f(0.062805, 0.591207, 0.902102), Vec3f(0.058382, 0.577691, 0.904429))
@@ -197,7 +197,7 @@ end
197197
mktempdir() do tmpdir
198198
save(joinpath(tmpdir, "test.obj"), msh)
199199
msh1 = load(joinpath(tmpdir, "test.obj"))
200-
msh3 = expand_faceviews(msh1) # should be unnecessary atm
200+
msh3 = expand_faceviews(Mesh(msh1)) # should be unnecessary atm
201201
@test length(faces(msh2)) == length(faces(msh3))
202202
for (f1, f2) in zip(faces(msh2), faces(msh3))
203203
@test coordinates(msh2)[f1] == coordinates(msh3)[f2]

0 commit comments

Comments
 (0)