ianmackenzie / elm-3d-scene

A high-level 3D rendering engine for Elm, with support for lighting, shadows, and realistic materials.
https://package.elm-lang.org/packages/ianmackenzie/elm-3d-scene/latest/
Mozilla Public License 2.0
205 stars 27 forks source link

Add support for automatic texture mapping #52

Open ianmackenzie opened 4 years ago

ianmackenzie commented 4 years ago

To start:

Would also need a way to specify the texture scale (meters per pixel? texture width? width and height?).

Should likely be implemented as functions that transform a Material - convert one that requires UV coordinates into one that doesn't.

ianmackenzie commented 4 years ago

Perhaps simpler: have some nice helpers for generating UV coordinates when building a mesh, e.g.

Mesh.planarUv : 
    Rectangle3d Meters coordinates
    -> Point3d Meters coordinates
    -> ( Float, Float )

Mesh.sphericalUv : 
    Frame3d Meters coordinates defines
    -> Point3d Meters coordinates
    -> ( Float, Float )