Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass input types to mesh #186

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/meshes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,36 +167,36 @@ function mesh(polygon::AbstractPolygon{Dim,T}; pointtype=Point{Dim,T},
return Mesh(positions, faces)
end

function triangle_mesh(primitive::Meshable{N}; nvertices=nothing) where {N}
function triangle_mesh(primitive::Meshable{N,T}; nvertices=nothing) where {N,T}
if nvertices !== nothing
@warn("nvertices argument deprecated. Wrap primitive in `Tesselation(primitive, nvertices)`")
primitive = Tesselation(primitive, nvertices)
end
return mesh(primitive; pointtype=Point{N,Float32}, facetype=GLTriangleFace)
return mesh(primitive; pointtype=Point{N,T}, facetype=GLTriangleFace)
end

function uv_mesh(primitive::Meshable{N,T}) where {N,T}
return mesh(primitive; pointtype=Point{N,Float32}, uv=Vec2f, facetype=GLTriangleFace)
return mesh(primitive; pointtype=Point{N,T}, uv=Vec{2,T}, facetype=GLTriangleFace)
end

function uv_normal_mesh(primitive::Meshable{N}) where {N}
return mesh(primitive; pointtype=Point{N,Float32}, uv=Vec2f, normaltype=Vec3f,
function uv_normal_mesh(primitive::Meshable{N,T}) where {N,T}
return mesh(primitive; pointtype=Point{N,T}, uv=Vec{2,T}, normaltype=Vec{3,T},
facetype=GLTriangleFace)
end

function normal_mesh(points::AbstractVector{<:AbstractPoint},
faces::AbstractVector{<:AbstractFace})
_points = decompose(Point3f, points)
function normal_mesh(points::AbstractVector{<:AbstractPoint{N,T}},
faces::AbstractVector{<:AbstractFace}) where {N,T}
_points = decompose(Point{N,T}, points)
_faces = decompose(GLTriangleFace, faces)
return Mesh(meta(_points; normals=normals(_points, _faces)), _faces)
end

function normal_mesh(primitive::Meshable{N}; nvertices=nothing) where {N}
function normal_mesh(primitive::Meshable{N,T}; nvertices=nothing) where {N,T}
if nvertices !== nothing
@warn("nvertices argument deprecated. Wrap primitive in `Tesselation(primitive, nvertices)`")
primitive = Tesselation(primitive, nvertices)
end
return mesh(primitive; pointtype=Point{N,Float32}, normaltype=Vec3f,
return mesh(primitive; pointtype=Point{N,T}, normaltype=Vec{3,T},
facetype=GLTriangleFace)
end

Expand Down