Skip to content

Emit default values in FFI bindings #188

@Jake-Shadle

Description

@Jake-Shadle

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions