Skip to content

Commit 90aed0e

Browse files
committed
small improvements
1 parent 991bacc commit 90aed0e

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/basic_types.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ function MetaMesh(points::AbstractVector{<:Point}, faces::AbstractVector{<:Abstr
270270
MetaMesh(Mesh(points, faces), values(meta))
271271
end
272272

273-
function MetaMesh(m::AbstractMesh; meta...)
274-
MetaMesh(m, values(meta))
273+
function MetaMesh(m::AbstractMesh; kw...)
274+
MetaMesh(m, merge(meta(m), values(kw)))
275275
end
276276

277277
@inline Base.hasproperty(mesh::MetaMesh, field::Symbol) = hasproperty(getfield(mesh, :meta), field)
@@ -283,5 +283,6 @@ faces(mesh::MetaMesh) = faces(Mesh(mesh))
283283
normals(mesh::MetaMesh) = hasproperty(mesh, :normals) ? mesh.normals : nothing
284284
texturecoordinates(mesh::MetaMesh) = hasproperty(mesh, :uv) ? mesh.uv : nothing
285285

286+
meta(@nospecialize(m)) = NamedTuple()
286287
meta(mesh::MetaMesh) = getfield(mesh, :meta)
287288
Mesh(mesh::MetaMesh) = getfield(mesh, :mesh)

src/fixed_arrays.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ Base.:(+)(a::Vec{N}, b::Point{N}) where {N} = Point{N}(a.data .+ b.data)
195195

196196
const VecTypes{N,T} = Union{StaticVector{N,T}, NTuple{N,T}}
197197
const Vecf{N} = Vec{N, Float32}
198+
const PointT{T} = Point{N,T} where N
198199
const Pointf{N} = Point{N,Float32}
199200
Base.isnan(p::Union{Point,Vec}) = any(x -> isnan(x), p)
200201

src/interfaces.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ function decompose(::Type{Point}, primitive::AbstractGeometry{Dim,T}) where {Dim
121121
return collect_with_eltype(Point{Dim,T}, coordinates(primitive))
122122
end
123123

124+
function decompose(::Type{PointT{T}}, primitive::AbstractGeometry{Dim}) where {Dim, T}
125+
return collect_with_eltype(Point{Dim,T}, coordinates(primitive))
126+
end
127+
124128
function decompose(::Type{T}, primitive) where {T}
125129
return collect_with_eltype(T, primitive)
126130
end

0 commit comments

Comments
 (0)