JuliaGeometry / GeometryBasics.jl

Basic Geometry Types
MIT License
165 stars 54 forks source link

fix Rect3 uv coordinates #181

Open ffreyer opened 1 year ago

ffreyer commented 1 year ago

The current uv's in Rect3 are just the xy components of the coordinates. That means uvs are doubly assigned and not normalized. This pr adds some manual uvs so that

img = [
    RGBf(1,0,0) RGBf(0,1,0) RGBf(0,0,1);
    RGBf(0,1,1) RGBf(1,0,1) RGBf(1,1,0);
]

colors a cube. (Colors applying to the [+x, +y, +z; -x, -y, -z] face.)

SimonDanisch commented 1 year ago

and not normalized.

They should be since I'm using the unit cube, no? Also, they need to return Vec3s, to work with 3d uvw coordinates...

ffreyer commented 1 year ago

They should be since I'm using the unit cube, no?

Oh, you're right.

Also, they need to return Vec3s, to work with 3d uvw coordinates...

Why do we need 3d uvw coordinates though? From what I've seen working with 2d uv coordinates is much more common. Makie also doesn't accept 3d textures, e.g. mesh(Rect3f(Point3f(0), Vec3f(1)), color = rand(RGBf, 2, 2, 2)) errors. So you can't use them there.

SimonDanisch commented 1 year ago

For volumes and for https://github.com/MakieOrg/Makie.jl/pull/2274

ffreyer commented 1 year ago

Isn't it much more common to texture a surface than a volume though?