-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Make Matrix3
an abstract over Float32Array (just like Matrix4
)
#1778
Conversation
Btw I checked if Openfl ever extends Matrix3 for any reason, but I did not find any such instance, so this probably won't be a breaking change, since the public facing functions and fields are all the same as before. Also, should I make this PR to the |
|
Cool |
d880a2e
to
2138b72
Compare
Uh-oh! I think that this change has broken some CFFI functions for Cairo when targeting HashLink. I noticed this call in particular is failing (because it's now getting a different type than it expects), but I think that there are others that are affected too.
|
I'll take a look. |
First impression: I don't think I like how CFFI handles This code assumes that
This code assumes that the class's second constructor has already initialized lime/project/src/math/Matrix3.cpp Line 70 in 78e99bf
|
Okay, with #1791 being merged, HashLink is working. However, I'm seeing that gradient fills aren't rendering in OpenFL with neko/cpp. The gradients seem to be rendering correctly on HashLink, though. One thing I see that makes me suspicious is that the documentation says the layout of the matrix is like this:
However, the constructor has this layout instead:
|
The documentation in the rest of the file isn't any more consistent. Some of them show But also, I don't think existing code should have been affected by this change. Yes it arranges the values in an array, but the existing code only refers to the variables, mapping I'll pull up the Wikipedia article and take a closer look. |
hi from memory flash was never very good at matrix. My suggestion is to just create a new Matrix3 and Matrix4 and leave the old without changing. Then users can upgrade if needed. |
for 3d projection https://github.com/nanjizal/geom/blob/master/src/geom/matrix/Projection.hx see my dice project. |
I assume you mean "the first row"? Because the code you linked to shows it in the rightmost column. Per Wikipedia, there are people who use both notations, but putting them in the right column is more common. (It's how I was taught, certainly.)
Lime's goal isn't to emulate Flash or to provide a full suite of math-related classes. As long as we have the |
Figured it out. CairoPattern wasn't converting to the new CairoMatrix3. Gradients now rendering correctly with my fix. |
Whoops, guess I should have done a full search. Good catch. |
far right is what I was explaining as per the link. Typical use is constraints using 1x4 and matrix/dual quaternion 4x3 https://nanjizal.github.io/try_geom/ |
lime.math.Matrix4
is an abstract overFloat32Array
which makes it possible to pass directly into gl functions likeGL.uniformMatrix4fv
but this does not seem to work forMatrix3
andGL.uniformMatrix3fv
unless we convert it into a Float32Array beforehand. So making Matrix3 an abstract as well should make it behave just like Matrix4