Skip to content
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

Emit default values in FFI bindings #188

Open
Jake-Shadle opened this issue Mar 2, 2023 · 0 comments
Open

Emit default values in FFI bindings #188

Jake-Shadle opened this issue Mar 2, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Jake-Shadle
Copy link
Member

One common change in PhysX 5 was to consolidate constructors, providing default values to preserve the behavior of the default constructor.

-PX_INLINE PxCapsuleGeometry() :						PxGeometry(PxGeometryType::eCAPSULE), radius(0), halfHeight(0)		{}
-PX_INLINE PxCapsuleGeometry(PxReal radius_, PxReal halfHeight_) :	PxGeometry(PxGeometryType::eCAPSULE), radius(radius_), halfHeight(halfHeight_)	{}
+PX_INLINE PxCapsuleGeometry(PxReal radius_=0.0f, PxReal halfHeight_=0.0f) :	PxGeometry(PxGeometryType::eCAPSULE), radius(radius_), halfHeight(halfHeight_)	{}

We could generate bindings to preserve the API in these cases, but that honestly feels a bit wasteful, that being said, it's a bit tedious to consult the C++ code to figure out which defaults are being used, so it would be nice to add the defaults as inline comments for each parameter so that the user can see the defaults in an overlay if they are using something like RLS, or at least be present in the physx_generated.rs code that they can inspect manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant