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

Fix x86 failures #229

Merged
merged 6 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
- windows-latest
arch:
- x64
- x86
exclude:
- os: macOS-latest
arch: x86
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GeometryBasics"
uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
authors = ["SimonDanisch <[email protected]>"]
version = "0.5.0"
version = "0.5.1"

[deps]
EarCut_jll = "5ae413db-bbd1-5e63-b57d-d24a61df00f5"
Expand Down
9 changes: 5 additions & 4 deletions src/basic_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,12 @@ struct Mesh{

vertex_attributes::NamedTuple{Names, VAT}
faces::FVT
views::Vector{UnitRange{Int}}
views::Vector{UnitRange{UInt32}}

function Mesh(
vertex_attributes::NamedTuple{Names, VAT},
fs::FVT,
views::Vector{UnitRange{Int}} = UnitRange{Int}[]
views::Vector{<: UnitRange{<: Integer}} = UnitRange{UInt32}[]
) where {
FT <: AbstractFace, FVT <: AbstractVector{FT}, Names, Dim, T,
VAT <: Tuple{<: AbstractVector{Point{Dim, T}}, Vararg{VertexAttributeType}}
Expand Down Expand Up @@ -669,13 +669,14 @@ and have faces of matching length.
sub-meshes. This is done by providing ranges for indexing faces which correspond
to the sub-meshes. By default this is left empty.
"""
function Mesh(faces::AbstractVector{<:AbstractFace}; views::Vector{UnitRange{Int}} = UnitRange{Int}[], attributes...)
function Mesh(faces::AbstractVector{<:AbstractFace};
views::Vector{<: UnitRange{<: Integer}} = UnitRange{UInt32}[], attributes...)
return Mesh(NamedTuple(attributes), faces, views)
end

function Mesh(points::AbstractVector{Point{Dim, T}},
faces::AbstractVector{<:AbstractFace};
views = UnitRange{Int}[], kwargs...) where {Dim, T}
views = UnitRange{UInt32}[], kwargs...) where {Dim, T}
va = (position = points, kwargs...)
return Mesh(va, faces, views)
end
Expand Down
30 changes: 15 additions & 15 deletions src/interfaces.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
coordinates(geometry)

Returns the positions/coordinates of a geometry.
Returns the positions/coordinates of a geometry.

This is allowed to return lazy iterators. Use `decompose(ConcretePointType, geometry)`
This is allowed to return lazy iterators. Use `decompose(ConcretePointType, geometry)`
to get a `Vector{ConcretePointType}` with `ConcretePointType` being something like
`Point3f`.
"""
Expand All @@ -14,9 +14,9 @@ end
"""
faces(geometry)

Returns the faces of a geometry.
Returns the faces of a geometry.

This is allowed to return lazy iterators. Use `decompose(ConcreteFaceType, geometry)`
This is allowed to return lazy iterators. Use `decompose(ConcreteFaceType, geometry)`
to get a `Vector{ConcreteFaceType}` with `ConcreteFaceType` being something like `GLTriangleFace`.
"""
function faces(f::AbstractVector{<:AbstractFace})
Expand All @@ -26,9 +26,9 @@ end
"""
normals(primitive)

Returns the normals of a geometry.
Returns the normals of a geometry.

This is allowed to return lazy iterators. Use `decompose_normals(ConcreteVecType, geometry)`
This is allowed to return lazy iterators. Use `decompose_normals(ConcreteVecType, geometry)`
to get a `Vector{ConcreteVecType}` with `ConcreteVecType` being something like `Vec3f`.
"""
function normals(primitive, nvertices=nothing; kw...)
Expand All @@ -49,10 +49,10 @@ end
"""
texturecoordinates(primitive)

Returns the texturecoordinates of a geometry.
Returns the texturecoordinates of a geometry.

This is allowed to return lazy iterators. Use `decompose_uv(ConcreteVecType, geometry)`
(or `decompose_uvw`) to get a `Vector{ConcreteVecType}` with `ConcreteVecType` being
This is allowed to return lazy iterators. Use `decompose_uv(ConcreteVecType, geometry)`
(or `decompose_uvw`) to get a `Vector{ConcreteVecType}` with `ConcreteVecType` being
something like `Vec2f`.
"""
texturecoordinates(primitive, nvertices=nothing) = nothing
Expand All @@ -61,9 +61,9 @@ texturecoordinates(primitive, nvertices=nothing) = nothing
Tessellation(primitive, nvertices)

When generating a mesh from an abstract geometry, we can typically generate it
at different levels of detail, i.e. with different amounts of vertices. The
at different levels of detail, i.e. with different amounts of vertices. The
`Tessellation` wrapper allows you to specify this level of detail. When generating
a mesh from a tessellated geometry, the added information will be passed to
a mesh from a tessellated geometry, the added information will be passed to
`coordinates`, `faces`, etc.

```julia
Expand Down Expand Up @@ -127,7 +127,7 @@ Normal() = Normal(Vec3f)
decompose(::Type{TargetType}, primitive)
decompose(::Type{TargetType}, data::AbstractVector)

Dependent on the given type, extracts data from the primtive and converts its
Dependent on the given type, extracts data from the primtive and converts its
eltype to `TargetType`.

Possible `TargetType`s:
Expand All @@ -149,22 +149,22 @@ function decompose(::Type{F}, primitive::AbstractGeometry) where {F<:AbstractFac
end
return decompose(F, f)
end

function decompose(::Type{F}, f::AbstractVector) where {F<:AbstractFace}
fs = faces(f)
isnothing(fs) && error("No faces defined for $(typeof(f))")
return collect_with_eltype(F, fs)
end

# TODO: Should this be a completely different function?
function decompose(::Type{F}, f::AbstractVector, views::Vector{UnitRange{Int}}) where {F<:AbstractFace}
function decompose(::Type{F}, f::AbstractVector, views::Vector{UnitRange{IT}}) where {F<:AbstractFace, IT<:Integer}
fs = faces(f)
isnothing(fs) && error("No faces defined for $(typeof(f))")
if isempty(views)
return collect_with_eltype(F, fs), views
else
output = F[]
new_views = sizehint!(UnitRange{Int}[], length(views))
new_views = sizehint!(UnitRange{IT}[], length(views))
for range in views
start = length(output) + 1
collect_with_eltype!(output, view(fs, range))
Expand Down
Loading