-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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 Vector4, Vector4i, Projection built-in types. #63219
Implement Vector4, Vector4i, Projection built-in types. #63219
Conversation
This may be done in #59970 already, so it's worth checking that PR's code just in case. |
@@ -91,11 +94,14 @@ class Variant { | |||
VECTOR3, | |||
VECTOR3I, | |||
TRANSFORM2D, | |||
VECTOR4, | |||
VECTOR4I, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's arbitrary, but this order doesn't really make sense. Why should Transform2D go in-between Vector3 and Vector4? I think we should consider reordering the types in the enum, maybe logical grouping, maybe alphabetical.
For logical grouping it would make sense to have Vector2/2i/3/3i/4/4i first, then Plane/Quat(/Color?), then Rect2/2i/AABB, then Transform2D, Basis, Transform3D, Projection.
EDIT: Updated my suggestion, now all types with 4 elements are together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its together with the other 4 component types so to me it makes sense that way. Moving then is far too much work also, so won't do without a very good reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon further inspection, I think the problem is that TRANSFORM2D should go above VECTOR3. We could change this in a separate PR I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also keep in mind, while I guess this isn't a problem since we're still in Alpha and we accept breakage, that adding new types in the middle will segfault any existing GDExtension that assumes the old numbering.
For posterity can you comment briefly on the difference between this PR and #59970? |
@clayjohn That one is only Vector4 and from my understanding it misses a few bits of the type registration in the core areas so it was not entirely correct. Because all the 3 types I added interact with each other, it was far easier to me to implement everything together. That said, that PR still implements a few more things like shader interaction, which I did not. I need to add that. |
596b048
to
900503c
Compare
900503c
to
1dba423
Compare
ef913f3
to
49ccf4b
Compare
Should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few mismatched argument names in the bindings.
Follow-up changes in the |
Love this @reduz , haven't got much to add that hasn't already been said. Agree with the names change to One thing I think we should discuss as a possibility is merging |
@BastiaanOlij EDIT: Also, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this change
I guess it would indeed be overkill to change From a usage point of view Color and Vector4 are different enough that on the game engine side it is definitely a defensible position that they should be separate classes if only to prevent confusion from users. |
cbf7273
to
440a66f
Compare
Implement built-in classes Vector4, Vector4i and Projection. * Two versions of Vector4 (float and integer). * A Projection class, which is a 4x4 matrix specialized in projection types. These types have been requested for a long time, but given they were very corner case they were not added before. Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity. **Q**: Why Projection and not Matrix4? **A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
440a66f
to
455c06e
Compare
@@ -91,11 +94,14 @@ class Variant { | |||
VECTOR3, | |||
VECTOR3I, | |||
TRANSFORM2D, | |||
VECTOR4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PackedVector4Array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can still use a regular array for this use case or PackedColorArray, so its not suuuuper important.
Thanks! |
Implement built-in classes Vector4, Vector4i and Projection.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
TODO:
FAQ:
Q: Why Projection and not Matrix4?
A: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a purpose. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is always used as a Projection, hence the naming.
Bugsquad edit: This closes godotengine/godot-proposals#629.
Bugsquad edit: Supersedes #59970.