-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
Implement shape transformations with matrix2d #771
Comments
this thing should be as simple as something like this actually (pseudo-code) :
and that's all ? |
transformPoint : function(x, y, vec) {
vec = vec || new me.Vector2d();
vec.x = x * this.a + y * this.c + this.e;
vec.y = x * this.b + y * this.d + this.f;
return vec;
}, |
I thought for sure we already had that ... Because I implemented it specifically for WebGL: Line 141 in 8311f97
melonJS/src/video/webgl/compositor.js Line 448 in 8311f97
Strange thing is you renamed it, for some reason... That's not very nice from a semver point of view; usually we would go through a deprecation period for API breakage like that. |
the function was private before I renamed it (@ignore tag) so does not really matter as nobody knew it was there, except you and me :) |
actually, only you knew it was there :P |
FWIW, the function multiplies a matrix and vector together. So the previous name was more fitting, right? The only other method we have named |
sure I can modify it back to |
also add a `transform` method for renderable, as they do inherit from me.Rect/me.Polygon, and this was causing cohesion issue with the parent API vs the object implementation,
Issue was reported on the forum: https://groups.google.com/d/msg/melonjs/lXxOv__I0fA/Y9G3rSEiGAAJ
The shapes API does not allow rotation or scaling around an arbitrary center point. Using matrix2d will solve this.
Bonus: #601 can be fixed by setting the default matrix to identity for orthographic projections, and a pre-projected matrix for isometric and hexagonal projections.
The text was updated successfully, but these errors were encountered: