Closed w0rm closed 7 years ago
Sounds reasonable to me. Do you have a particular API in mind?
@fredcy the problem with Mat4
is that it contains more values than we can have in a Tuple
, but should work just fine with a record type.
mat4 : Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Float -> Mat4
toRecord : Mat4 -> Mat4Record
fromRecord : Mat4Record -> Mat4
type alias Mat4Record =
{ m11 : Float
, m21 : Float
, m31 : Float
, m41 : Float
, m12 : Float
, m22 : Float
, m32 : Float
, m42 : Float
, m13 : Float
, m23 : Float
, m33 : Float
, m43 : Float
, m14 : Float
, m24 : Float
, m34 : Float
, m44 : Float
}
Can you float this API plan to the Elm WebGL community (and/or other users of this package) and get some feedback on whether it's the right one?
I have added a constructor a while back: makeFromList
not sure if that helps. But yeah a record would also be nice as this does somewhat away with the question of how the col/rows are aligned in the list.
@felixLam oh, I've missed it, because I assumed that all the make...
functions were generating Mat4
and not taking the raw values.
Summarizing the discussion here and on Slack, fromRecord/toRecord
is good, because:
I got Ok from @eeue56 and @Zinggi so I will open a pull request.
All types in linear algebra, except
Mat4
may be constructed from floats and deconstructed back.I need to get the raw data out of
Mat4
for the CSS3D transforms in this example: https://github.com/w0rm/elm-webgl-playground/blob/master/CSS3d.elm