Skip to content

Commit f54bdaf

Browse files
authored
Merge pull request #21 from JuliaGeometry/sd/fix4wgl
fixes
2 parents 3d264d0 + 1b42e9f commit f54bdaf

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/basic_types.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ end
362362

363363
function Base.propertynames(mesh::Mesh)
364364
names = propertynames(getfield(mesh, :simplices))
365-
if :positions in names
365+
if :position in names
366366
return names
367367
else
368368
# a mesh always has positions!

src/geometry_primitives.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ function coordinates(s::Circle, nvertices=64)
361361
return (inner(fi) for fi in LinRange(0, 2pi, nvertices))
362362
end
363363

364+
function texturecoordinates(s::Circle, nvertices=64)
365+
return coordinates(Circle(Point2f0(0.5), 0.5f0), nvertices)
366+
end
367+
364368
function coordinates(s::Sphere, nvertices=24)
365369
θ = LinRange(0, pi, nvertices); φ = LinRange(0, 2pi, nvertices)
366370
inner(θ, φ) = Point(cos(φ)*sin(θ), sin(φ)*sin(θ), cos(θ)) .* s.r .+ s.center

src/meshes.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ function mesh(primitive::GeometryPrimitive;
117117
attributes[:normals] = primitive_normals
118118
else
119119
# Normals not implemented for primitive, so we calculate them!
120-
attributes[:normals] = normals(positions, faces)
120+
n = normals(positions, faces)
121+
if n !== nothing # ok jeez, this is a 2d mesh which cant have normals
122+
attributes[:normals] = n
123+
end
121124
end
122125
end
123-
124126
return Mesh(meta(positions; attributes...), faces)
125127
end
126128

0 commit comments

Comments
 (0)