Cramming PhysX in there

More PhysX work

More PhysX work
This commit is contained in:
2025-07-06 23:58:40 +02:00
parent c3a1686325
commit 84350b85ab
3257 changed files with 587241 additions and 66 deletions

View File

@@ -0,0 +1 @@
#include "PxPhysicsAPI.h"

View File

@@ -0,0 +1,95 @@
#include "foundation/PxFlags.h"
#include "PxArticulationReducedCoordinate.h"
namespace physx {
// From PxActorData.h
/**
\brief Identifies each type of information for retrieving from actor.
@see PxScene::applyActorData
*/
struct PxActorCacheFlag
{
enum Enum
{
eACTOR_DATA = (1 << 0), //include transform and velocity
eFORCE = (1 << 2),
eTORQUE = (1 << 3)
};
};
/**
\brief Collection of set bits defined in PxActorCacheFlag.
@see PxActorCacheFlag
*/
typedef PxFlags<PxActorCacheFlag::Enum, PxU16> PxActorCacheFlags;
// From PxArticulationFlags.h
/**
\brief Flags which affect the behavior of PxShapes.
@see PxShape PxShape.setFlag()
*/
struct PxShapeFlag
{
enum Enum
{
/**
\brief The shape will partake in collision in the physical simulation.
\note It is illegal to raise the eSIMULATION_SHAPE and eTRIGGER_SHAPE flags.
In the event that one of these flags is already raised the sdk will reject any
attempt to raise the other. To raise the eSIMULATION_SHAPE first ensure that
eTRIGGER_SHAPE is already lowered.
\note This flag has no effect if simulation is disabled for the corresponding actor (see #PxActorFlag::eDISABLE_SIMULATION).
@see PxSimulationEventCallback.onContact() PxScene.setSimulationEventCallback() PxShape.setFlag(), PxShape.setFlags()
*/
eSIMULATION_SHAPE = (1<<0),
/**
\brief The shape will partake in scene queries (ray casts, overlap tests, sweeps, ...).
*/
eSCENE_QUERY_SHAPE = (1<<1),
/**
\brief The shape is a trigger which can send reports whenever other shapes enter/leave its volume.
\note Triangle meshes and heightfields can not be triggers. Shape creation will fail in these cases.
\note Shapes marked as triggers do not collide with other objects. If an object should act both
as a trigger shape and a collision shape then create a rigid body with two shapes, one being a
trigger shape and the other a collision shape. It is illegal to raise the eTRIGGER_SHAPE and
eSIMULATION_SHAPE flags on a single PxShape instance. In the event that one of these flags is already
raised the sdk will reject any attempt to raise the other. To raise the eTRIGGER_SHAPE flag first
ensure that eSIMULATION_SHAPE flag is already lowered.
\note Trigger shapes will no longer send notification events for interactions with other trigger shapes.
\note Shapes marked as triggers are allowed to participate in scene queries, provided the eSCENE_QUERY_SHAPE flag is set.
\note This flag has no effect if simulation is disabled for the corresponding actor (see #PxActorFlag::eDISABLE_SIMULATION).
@see PxSimulationEventCallback.onTrigger() PxScene.setSimulationEventCallback() PxShape.setFlag(), PxShape.setFlags()
*/
eTRIGGER_SHAPE = (1<<2),
/**
\brief Enable debug renderer for this shape
@see PxScene.getRenderBuffer() PxRenderBuffer PxVisualizationParameter
*/
eVISUALIZATION = (1<<3)
};
};
/**
\brief collection of set bits defined in PxShapeFlag.
@see PxShapeFlag
*/
typedef PxFlags<PxShapeFlag::Enum,PxU8> PxShapeFlags;
}

View File

@@ -0,0 +1,48 @@
// From PxBroadPhase.h
namespace physx {
/**
\brief Broad phase algorithm used in the simulation
eSAP is a good generic choice with great performance when many objects are sleeping. Performance
can degrade significantly though, when all objects are moving, or when large numbers of objects
are added to or removed from the broad phase. This algorithm does not need world bounds to be
defined in order to work.
eMBP is an alternative broad phase algorithm that does not suffer from the same performance
issues as eSAP when all objects are moving or when inserting large numbers of objects. However
its generic performance when many objects are sleeping might be inferior to eSAP, and it requires
users to define world bounds in order to work.
eABP is a revisited implementation of MBP, which automatically manages broad-phase regions.
It offers the convenience of eSAP (no need to define world bounds or regions) and the performance
of eMBP when a lot of objects are moving. While eSAP can remain faster when most objects are
sleeping and eMBP can remain faster when it uses a large number of properly-defined regions,
eABP often gives the best performance on average and the best memory usage.
ePABP is a parallel implementation of ABP. It can often be the fastest (CPU) broadphase, but it
can use more memory than ABP.
eGPU is a GPU implementation of the incremental sweep and prune approach. Additionally, it uses a ABP-style
initial pair generation approach to avoid large spikes when inserting shapes. It not only has the advantage
of traditional SAP approch which is good for when many objects are sleeping, but due to being fully parallel,
it also is great when lots of shapes are moving or for runtime pair insertion and removal. It can become a
performance bottleneck if there are a very large number of shapes roughly projecting to the same values
on a given axis. If the scene has a very large number of shapes in an actor, e.g. a humanoid, it is recommended
to use an aggregate to represent multi-shape or multi-body actors to minimize stress placed on the broad phase.
*/
struct PxBroadPhaseType
{
enum Enum
{
eSAP, //!< 3-axes sweep-and-prune
eMBP, //!< Multi box pruning
eABP, //!< Automatic box pruning
ePABP, //!< Parallel automatic box pruning
eGPU, //!< GPU broad phase
eLAST
};
};
} // physx

View File

@@ -0,0 +1,9 @@
namespace physx {
/** enum for empty constructor tag*/
enum PxEMPTY
{
PxEmpty
};
} // physx

View File

@@ -0,0 +1,79 @@
namespace physx {
// From PxThread.h
struct PxThreadPriority
{
enum Enum
{
eHIGH = 0, //!< High priority
eABOVE_NORMAL = 1, //!< Above Normal priority
eNORMAL = 2, //!< Normal/default priority
eBELOW_NORMAL = 3, //!< Below Normal priority
eLOW = 4, //!< Low priority.
eFORCE_DWORD = 0xffFFffFF
};
};
// From PxShape.h
/**
\brief Flags which affect the behavior of PxShapes.
@see PxShape PxShape.setFlag()
*/
struct PxShapeFlag
{
enum Enum
{
/**
\brief The shape will partake in collision in the physical simulation.
\note It is illegal to raise the eSIMULATION_SHAPE and eTRIGGER_SHAPE flags.
In the event that one of these flags is already raised the sdk will reject any
attempt to raise the other. To raise the eSIMULATION_SHAPE first ensure that
eTRIGGER_SHAPE is already lowered.
\note This flag has no effect if simulation is disabled for the corresponding actor (see #PxActorFlag::eDISABLE_SIMULATION).
@see PxSimulationEventCallback.onContact() PxScene.setSimulationEventCallback() PxShape.setFlag(), PxShape.setFlags()
*/
eSIMULATION_SHAPE = (1<<0),
/**
\brief The shape will partake in scene queries (ray casts, overlap tests, sweeps, ...).
*/
eSCENE_QUERY_SHAPE = (1<<1),
/**
\brief The shape is a trigger which can send reports whenever other shapes enter/leave its volume.
\note Triangle meshes and heightfields can not be triggers. Shape creation will fail in these cases.
\note Shapes marked as triggers do not collide with other objects. If an object should act both
as a trigger shape and a collision shape then create a rigid body with two shapes, one being a
trigger shape and the other a collision shape. It is illegal to raise the eTRIGGER_SHAPE and
eSIMULATION_SHAPE flags on a single PxShape instance. In the event that one of these flags is already
raised the sdk will reject any attempt to raise the other. To raise the eTRIGGER_SHAPE flag first
ensure that eSIMULATION_SHAPE flag is already lowered.
\note Trigger shapes will no longer send notification events for interactions with other trigger shapes.
\note Shapes marked as triggers are allowed to participate in scene queries, provided the eSCENE_QUERY_SHAPE flag is set.
\note This flag has no effect if simulation is disabled for the corresponding actor (see #PxActorFlag::eDISABLE_SIMULATION).
@see PxSimulationEventCallback.onTrigger() PxScene.setSimulationEventCallback() PxShape.setFlag(), PxShape.setFlags()
*/
eTRIGGER_SHAPE = (1<<2),
/**
\brief Enable debug renderer for this shape
@see PxScene.getRenderBuffer() PxRenderBuffer PxVisualizationParameter
*/
eVISUALIZATION = (1<<3)
};
};
} // physx

View File

@@ -0,0 +1,106 @@
#include "characterkinematic/PxController.h"
namespace physx {
/**
\brief Descriptor for a box character controller.
@see PxBoxController PxControllerDesc
*/
class PxBoxControllerDesc : public PxControllerDesc
{
public:
/**
\brief constructor sets to default.
*/
PX_INLINE PxBoxControllerDesc();
PX_INLINE virtual ~PxBoxControllerDesc() {}
/**
\brief copy constructor.
*/
PX_INLINE PxBoxControllerDesc(const PxBoxControllerDesc&);
/**
\brief assignment operator.
*/
PX_INLINE PxBoxControllerDesc& operator=(const PxBoxControllerDesc&);
/**
\brief (re)sets the structure to the default.
*/
PX_INLINE virtual void setToDefault();
/**
\brief returns true if the current settings are valid
\return True if the descriptor is valid.
*/
PX_INLINE virtual bool isValid() const;
/**
\brief Half height
<b>Default:</b> 1.0
*/
PxF32 halfHeight; // Half-height in the "up" direction
/**
\brief Half side extent
<b>Default:</b> 0.5
*/
PxF32 halfSideExtent; // Half-extent in the "side" direction
/**
\brief Half forward extent
<b>Default:</b> 0.5
*/
PxF32 halfForwardExtent; // Half-extent in the "forward" direction
protected:
PX_INLINE void copy(const PxBoxControllerDesc&);
};
PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc() :
PxControllerDesc (PxControllerShapeType::eBOX),
halfHeight (1.0f),
halfSideExtent (0.5f),
halfForwardExtent (0.5f)
{
}
PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc(const PxBoxControllerDesc& other) : PxControllerDesc(other)
{
copy(other);
}
PX_INLINE PxBoxControllerDesc& PxBoxControllerDesc::operator=(const PxBoxControllerDesc& other)
{
PxControllerDesc::operator=(other);
copy(other);
return *this;
}
PX_INLINE void PxBoxControllerDesc::copy(const PxBoxControllerDesc& other)
{
halfHeight = other.halfHeight;
halfSideExtent = other.halfSideExtent;
halfForwardExtent = other.halfForwardExtent;
}
PX_INLINE void PxBoxControllerDesc::setToDefault()
{
*this = PxBoxControllerDesc();
}
PX_INLINE bool PxBoxControllerDesc::isValid() const
{
if(!PxControllerDesc::isValid()) return false;
if(halfHeight<=0.0f) return false;
if(halfSideExtent<=0.0f) return false;
if(halfForwardExtent<=0.0f) return false;
if(stepOffset>2.0f*halfHeight) return false; // Prevents obvious mistakes
return true;
}
}

View File

@@ -0,0 +1,79 @@
#include "common/PxBase.h"
#include "foundation/PxMath.h"
namespace physx {
class PxJointLimitParameters
{
public:
PxReal restitution;
PxReal bounceThreshold;
PxReal stiffness;
PxReal damping;
PxReal contactDistance_deprecated;
PxJointLimitParameters() :
restitution (0.0f),
bounceThreshold (0.0f),
stiffness (0.0f),
damping (0.0f),
contactDistance_deprecated (0.0f)
{
}
PxJointLimitParameters(const PxJointLimitParameters& p) :
restitution (p.restitution),
bounceThreshold (p.bounceThreshold),
stiffness (p.stiffness),
damping (p.damping),
contactDistance_deprecated (p.contactDistance_deprecated)
{
}
/**
\brief Returns true if the current settings are valid.
\return true if the current settings are valid
*/
PX_INLINE bool isValid() const
{
return PxIsFinite(restitution) && restitution >= 0 && restitution <= 1 &&
PxIsFinite(stiffness) && stiffness >= 0 &&
PxIsFinite(damping) && damping >= 0 &&
PxIsFinite(bounceThreshold) && bounceThreshold >= 0 &&
PxIsFinite(contactDistance_deprecated) && contactDistance_deprecated >= 0;
}
PX_INLINE bool isSoft() const
{
return damping>0 || stiffness>0;
}
protected:
~PxJointLimitParameters() {}
};
class PxJointAngularLimitPair : public PxJointLimitParameters
{
public:
PxReal upper, lower;
PxJointAngularLimitPair(PxReal lowerLimit, PxReal upperLimit, PxReal contactDist_deprecated = -1.0f) :
upper(upperLimit),
lower(lowerLimit)
{
PxJointLimitParameters::contactDistance_deprecated = contactDist_deprecated ==-1.0f ? PxMin(0.1f, 0.49f*(upperLimit-lowerLimit)) : contactDist_deprecated;
bounceThreshold = 0.5f;
}
/**
\brief Returns true if the limit is valid.
\return true if the current settings are valid
*/
PX_INLINE bool isValid() const
{
return PxJointLimitParameters::isValid() &&
PxIsFinite(upper) && PxIsFinite(lower) && upper >= lower;
}
};
}

View File

@@ -0,0 +1 @@
#include "PxPhysics.h"

View File

@@ -0,0 +1 @@
#include "PxShape.h"

View File

@@ -0,0 +1,50 @@
#include <stddef.h>
namespace physx {
/**
\brief Abstract base class for an application defined memory allocator that can be used by the Nv library.
\note The SDK state should not be modified from within any allocation/free function.
<b>Threading:</b> All methods of this class should be thread safe as it can be called from the user thread
or the physics processing thread(s).
*/
class PxAllocatorCallback
{
public:
virtual ~PxAllocatorCallback()
{
}
/**
\brief Allocates size bytes of memory, which must be 16-byte aligned.
This method should never return NULL. If you run out of memory, then
you should terminate the app or take some other appropriate action.
<b>Threading:</b> This function should be thread safe as it can be called in the context of the user thread
and physics processing thread(s).
\param size Number of bytes to allocate.
\param typeName Name of the datatype that is being allocated
\param filename The source file which allocated the memory
\param line The source line which allocated the memory
\return The allocated block of memory.
*/
virtual void* allocate(size_t size, const char* typeName, const char* filename, int line) = 0;
/**
\brief Frees memory previously allocated by allocate().
<b>Threading:</b> This function should be thread safe as it can be called in the context of the user thread
and physics processing thread(s).
\param ptr Memory to free.
*/
virtual void deallocate(void* ptr) = 0;
};
} // namespace physx

View File

@@ -0,0 +1 @@
#include "solver/PxSolverDefs.h"

View File

@@ -0,0 +1,18 @@
namespace physx {
class PxAllocatorCallback;
class PxAllocatorCallback
{
public:
virtual ~PxAllocatorCallback()
{
}
virtual void deallocate(void* ptr) = 0;
};
class MemoryBuffer;
} // namespace physx

View File

@@ -0,0 +1,15 @@
#include "common/PxPhysXCommonConfig.h"
#include "foundation/PxVecTransform.h"
namespace physx {
class PxReffyMcRefface
{
public:
PxVec3 shapeSpaceCenterOfMass;
const PxTransform& transform;
const PxMat33& vertex2Shape;
const PxMat33& shape2Vertex;
const bool isIdentityScale;
};
}

View File

@@ -0,0 +1 @@
#include "PxQueryReport.h"

View File

@@ -0,0 +1,59 @@
fn gen_enums(which: &str, to_emit: &'static [&str]) -> anyhow::Result<String> {
let (ast, _) = pxbind::get_parsed_ast(format!("tests/data/enum/{which}"))?;
let mut consumer = pxbind::consumer::AstConsumer::default();
consumer.consume(&ast)?;
let generated = {
let record_filter = |_rb: &pxbind::consumer::RecBinding<'_>| false;
let enum_filter = |eb: &pxbind::consumer::EnumBinding<'_>| {
to_emit.is_empty() || to_emit.iter().any(|te| *te == eb.name)
};
let generator = pxbind::generator::Generator {
record_filter: Box::new(record_filter),
enum_filter: Box::new(enum_filter),
..Default::default()
};
let mut buffer = Vec::new();
generator.generate_rust_enums(&consumer, &mut buffer, 0)?;
String::from_utf8(buffer)?
};
Ok(generated)
}
/// Verifies we can generate appropriate Rust enums for vanilla, i32 default C++ enums
#[test]
fn i32() {
insta::assert_snapshot!(gen_enums("i32.h", &[]).unwrap());
}
/// Verifies we can generate appropriate Rust enums for C++ enums that have been
/// old school style forced to be u32
#[test]
fn u32() {
insta::assert_snapshot!(gen_enums("u32.h", &[]).unwrap());
}
/// Verifies that enums not scoped to a struct can be parsed
#[test]
fn simple() {
insta::assert_snapshot!(gen_enums("simple.h", &[]).unwrap());
}
/// Verifies that enums and their `PxFlags<>` wrappers can be properly bound
#[test]
fn flags() {
insta::assert_snapshot!(gen_enums(
"flags.h",
&[
"PxActorCacheFlag",
"PxArticulationCacheFlag",
"PxShapeFlag",
"PxArticulationSensorFlag"
]
)
.unwrap());
}

View File

@@ -0,0 +1,44 @@
struct Functions {
cpp: String,
rust: String,
}
fn gen_functions(which: &str) -> anyhow::Result<Functions> {
let (ast, _) = pxbind::get_parsed_ast(format!("tests/data/functions/{which}"))?;
let mut consumer = pxbind::consumer::AstConsumer::default();
consumer.consume(&ast)?;
let record_filter = |_rb: &pxbind::consumer::RecBinding<'_>| false;
let enum_filter = |_eb: &pxbind::consumer::EnumBinding<'_>| false;
let func_filter = |fb: &pxbind::consumer::FuncBinding<'_>| fb.owning_class().is_none();
let generator = pxbind::generator::Generator {
record_filter: Box::new(record_filter),
enum_filter: Box::new(enum_filter),
func_filter: Box::new(func_filter),
};
let cpp = {
let mut buffer = Vec::new();
generator.generate_cpp_functions(&consumer, &mut buffer, 0)?;
String::from_utf8(buffer)?
};
let rust = {
let mut buffer = Vec::new();
generator.generate_rust_functions(&consumer, &mut buffer, 0)?;
String::from_utf8(buffer)?
};
Ok(Functions { cpp, rust })
}
/// Verifies we can collect free functions
#[test]
fn plain_functions() {
let mo = gen_functions("functions.h").unwrap();
insta::assert_snapshot!(mo.cpp);
insta::assert_snapshot!(mo.rust);
}

View File

@@ -0,0 +1,78 @@
struct Functions {
cpp: String,
rust: String,
}
fn gen_functions(which: &str, to_emit: &'static [&str]) -> anyhow::Result<Functions> {
let (ast, _) = pxbind::get_parsed_ast(format!("tests/data/functions/{which}"))?;
let mut consumer = pxbind::consumer::AstConsumer::default();
consumer.consume(&ast)?;
let record_filter = |_rb: &pxbind::consumer::RecBinding<'_>| false;
let enum_filter = |_eb: &pxbind::consumer::EnumBinding<'_>| false;
let func_filter = |fb: &pxbind::consumer::FuncBinding<'_>| {
if let Some(cname) = fb.owning_class() {
to_emit.is_empty() || to_emit.iter().any(|te| *te == cname)
} else {
false
}
};
let generator = pxbind::generator::Generator {
record_filter: Box::new(record_filter),
enum_filter: Box::new(enum_filter),
func_filter: Box::new(func_filter),
};
let cpp = {
let mut buffer = Vec::new();
generator.generate_cpp_functions(&consumer, &mut buffer, 0)?;
String::from_utf8(buffer)?
};
let rust = {
let mut buffer = Vec::new();
generator.generate_rust_functions(&consumer, &mut buffer, 0)?;
String::from_utf8(buffer)?
};
Ok(Functions { cpp, rust })
}
/// Verifies that reference fields are reflected in the size and layout, but aren't
/// actually publicly exposed
#[test]
fn methods_complex() {
let mo = gen_functions("methods_complex.h", &["PxShape", "PxThreadImpl"]).unwrap();
insta::assert_snapshot!(mo.cpp);
insta::assert_snapshot!(mo.rust);
}
/// Verifies constructors of various kinds are properly bound, and properly
/// named to avoid clashes
#[test]
fn constructors() {
let mo = gen_functions("constructors.h", &["PxBoxControllerDesc", "PxFilterData"]).unwrap();
insta::assert_snapshot!(mo.cpp);
insta::assert_snapshot!(mo.rust);
}
/// Verifies destructors are properly emitted or omitted
#[test]
fn destructor() {
let mo = gen_functions(
"destructors.h",
&[
"PxActor",
"PxJointLimitParameters",
"PxJointAngularLimitPair",
],
)
.unwrap();
insta::assert_snapshot!(mo.cpp);
insta::assert_snapshot!(mo.rust);
}

View File

@@ -0,0 +1,109 @@
struct RecordOutput {
structgen: String,
size_asserts: String,
rust_decls: String,
}
fn gen_records(which: &str, to_emit: &'static [&str]) -> anyhow::Result<RecordOutput> {
let (ast, _) = pxbind::get_parsed_ast(format!("tests/data/record/{which}"))?;
let mut consumer = pxbind::consumer::AstConsumer::default();
consumer.consume(&ast)?;
let record_filter = |rb: &pxbind::consumer::RecBinding<'_>| {
to_emit.is_empty() || to_emit.iter().any(|te| rb == *te)
};
let generator = pxbind::generator::Generator {
record_filter: Box::new(record_filter),
..Default::default()
};
let structgen = {
let mut sg = Vec::new();
generator.generate_structgen(&consumer, &mut sg)?;
String::from_utf8(sg)?
};
let size_asserts = {
let mut sa = Vec::new();
generator.generate_size_asserts(&consumer, &mut sa)?;
String::from_utf8(sa)?
};
let rust_decls = {
let mut rd = Vec::new();
generator.generate_rust_records(&consumer, &mut rd)?;
String::from_utf8(rd)?
};
Ok(RecordOutput {
structgen,
size_asserts,
rust_decls,
})
}
/// Verifies that abstract base classes with no fields are properly bound
#[test]
fn abstract_() {
let ro = gen_records("abstract.h", &[]).unwrap();
insta::assert_snapshot!(ro.structgen);
insta::assert_snapshot!(ro.size_asserts);
insta::assert_snapshot!(ro.rust_decls);
}
/// Verifies that reference fields are reflected in the size and layout, but aren't
/// actually publicly exposed
#[test]
fn ref_fields() {
let ro = gen_records("ref_fields.h", &["PxReffyMcRefface"]).unwrap();
insta::assert_snapshot!(ro.structgen);
insta::assert_snapshot!(ro.size_asserts);
insta::assert_snapshot!(ro.rust_decls);
}
/// Ensures we can generate PODs that wrap types that are only exposed publicly
/// via pointer
#[test]
fn ptr_only() {
let ro = gen_records("ptr_only.h", &[]).unwrap();
insta::assert_snapshot!(ro.structgen);
insta::assert_snapshot!(ro.size_asserts);
insta::assert_snapshot!(ro.rust_decls);
}
/// Ensure we can parse templates, template specializations, and template parameters
/// and stamp out unique types for each template + template param
#[test]
#[ignore]
fn templates() {
let ro = gen_records(
"templates.h",
&[
"PxRaycastCallback",
"PxOverlapCallback",
"PxSweepCallback",
"PxRaycastBuffer",
"PxOverlapBuffer",
],
)
.unwrap();
insta::assert_snapshot!(ro.structgen);
insta::assert_snapshot!(ro.size_asserts);
insta::assert_snapshot!(ro.rust_decls);
}
/// More complicated records with multiple levels of inheritance
#[test]
fn complex() {
let ro = gen_records("complex.h", &[]).unwrap();
insta::assert_snapshot!(ro.structgen);
insta::assert_snapshot!(ro.size_asserts);
insta::assert_snapshot!(ro.rust_decls);
}

View File

@@ -0,0 +1,141 @@
---
source: physx-sys/pxbind/tests/enums.rs
expression: "gen_enums(\"flags.h\",\n &[\"PxActorCacheFlag\", \"PxArticulationCacheFlag\", \"PxShapeFlag\",\n \"PxArticulationSensorFlag\"]).unwrap()"
---
/// These flags determine what data is read or written to the internal articulation data via cache.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum PxArticulationCacheFlag {
/// The joint velocities, see PxArticulationCache::jointVelocity.
Velocity = 1,
/// The joint accelerations, see PxArticulationCache::jointAcceleration.
Acceleration = 2,
/// The joint positions, see PxArticulationCache::jointPosition.
Position = 4,
/// The joint forces, see PxArticulationCache::jointForce.
Force = 8,
/// The link velocities, see PxArticulationCache::linkVelocity.
LinkVelocity = 16,
/// The link accelerations, see PxArticulationCache::linkAcceleration.
LinkAcceleration = 32,
/// Root link transform, see PxArticulationCache::rootLinkData.
RootTransform = 64,
/// Root link velocities (read/write) and accelerations (read), see PxArticulationCache::rootLinkData.
RootVelocities = 128,
/// The spatial sensor forces, see PxArticulationCache::sensorForces.
SensorForces = 256,
/// Solver constraint joint forces, see PxArticulationCache::jointSolverForces.
JointSolverForces = 512,
All = 247,
}
bitflags::bitflags! {
/// Flags for [`PxArticulationCacheFlag`]
#[derive(Default)]
#[repr(transparent)]
pub struct PxArticulationCacheFlags: u32 {
const Velocity = 1 << 0;
const Acceleration = 1 << 1;
const Position = 1 << 2;
const Force = 1 << 3;
const LinkVelocity = 1 << 4;
const LinkAcceleration = 1 << 5;
const RootTransform = 1 << 6;
const RootVelocities = 1 << 7;
const SensorForces = 1 << 8;
const JointSolverForces = 1 << 9;
const All = Self::Velocity.bits | Self::Acceleration.bits | Self::Position.bits | Self::LinkVelocity.bits | Self::LinkAcceleration.bits | Self::RootTransform.bits | Self::RootVelocities.bits;
}
}
/// Flags to configure the forces reported by articulation link sensors.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum PxArticulationSensorFlag {
/// Raise to receive forces from forward dynamics.
ForwardDynamicsForces = 1,
/// Raise to receive forces from constraint solver.
ConstraintSolverForces = 2,
/// Raise to receive forces in the world rotation frame, otherwise they will be reported in the sensor's local frame.
WorldFrame = 4,
}
bitflags::bitflags! {
/// Flags for [`PxArticulationSensorFlag`]
#[derive(Default)]
#[repr(transparent)]
pub struct PxArticulationSensorFlags: u8 {
const ForwardDynamicsForces = 1 << 0;
const ConstraintSolverForces = 1 << 1;
const WorldFrame = 1 << 2;
}
}
/// Identifies each type of information for retrieving from actor.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum PxActorCacheFlag {
ActorData = 1,
Force = 4,
Torque = 8,
}
bitflags::bitflags! {
/// Flags for [`PxActorCacheFlag`]
#[derive(Default)]
#[repr(transparent)]
pub struct PxActorCacheFlags: u16 {
const ActorData = 1 << 0;
const Force = 1 << 2;
const Torque = 1 << 3;
}
}
/// Flags which affect the behavior of PxShapes.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum PxShapeFlag {
/// The shape will partake in collision in the physical simulation.
///
/// It is illegal to raise the eSIMULATION_SHAPE and eTRIGGER_SHAPE flags.
/// In the event that one of these flags is already raised the sdk will reject any
/// attempt to raise the other. To raise the eSIMULATION_SHAPE first ensure that
/// eTRIGGER_SHAPE is already lowered.
///
/// This flag has no effect if simulation is disabled for the corresponding actor (see [`PxActorFlag::eDISABLE_SIMULATION`]).
SimulationShape = 1,
/// The shape will partake in scene queries (ray casts, overlap tests, sweeps, ...).
SceneQueryShape = 2,
/// The shape is a trigger which can send reports whenever other shapes enter/leave its volume.
///
/// Triangle meshes and heightfields can not be triggers. Shape creation will fail in these cases.
///
/// Shapes marked as triggers do not collide with other objects. If an object should act both
/// as a trigger shape and a collision shape then create a rigid body with two shapes, one being a
/// trigger shape and the other a collision shape. It is illegal to raise the eTRIGGER_SHAPE and
/// eSIMULATION_SHAPE flags on a single PxShape instance. In the event that one of these flags is already
/// raised the sdk will reject any attempt to raise the other. To raise the eTRIGGER_SHAPE flag first
/// ensure that eSIMULATION_SHAPE flag is already lowered.
///
/// Trigger shapes will no longer send notification events for interactions with other trigger shapes.
///
/// Shapes marked as triggers are allowed to participate in scene queries, provided the eSCENE_QUERY_SHAPE flag is set.
///
/// This flag has no effect if simulation is disabled for the corresponding actor (see [`PxActorFlag::eDISABLE_SIMULATION`]).
TriggerShape = 4,
/// Enable debug renderer for this shape
Visualization = 8,
}
bitflags::bitflags! {
/// Flags for [`PxShapeFlag`]
#[derive(Default)]
#[repr(transparent)]
pub struct PxShapeFlags: u8 {
const SimulationShape = 1 << 0;
const SceneQueryShape = 1 << 1;
const TriggerShape = 1 << 2;
const Visualization = 1 << 3;
}
}

View File

@@ -0,0 +1,48 @@
---
source: physx-sys/pxbind/tests/enums.rs
expression: "gen_enums(\"i32.h\", &[]).unwrap()"
---
/// Broad phase algorithm used in the simulation
///
/// eSAP is a good generic choice with great performance when many objects are sleeping. Performance
/// can degrade significantly though, when all objects are moving, or when large numbers of objects
/// are added to or removed from the broad phase. This algorithm does not need world bounds to be
/// defined in order to work.
///
/// eMBP is an alternative broad phase algorithm that does not suffer from the same performance
/// issues as eSAP when all objects are moving or when inserting large numbers of objects. However
/// its generic performance when many objects are sleeping might be inferior to eSAP, and it requires
/// users to define world bounds in order to work.
///
/// eABP is a revisited implementation of MBP, which automatically manages broad-phase regions.
/// It offers the convenience of eSAP (no need to define world bounds or regions) and the performance
/// of eMBP when a lot of objects are moving. While eSAP can remain faster when most objects are
/// sleeping and eMBP can remain faster when it uses a large number of properly-defined regions,
/// eABP often gives the best performance on average and the best memory usage.
///
/// ePABP is a parallel implementation of ABP. It can often be the fastest (CPU) broadphase, but it
/// can use more memory than ABP.
///
/// eGPU is a GPU implementation of the incremental sweep and prune approach. Additionally, it uses a ABP-style
/// initial pair generation approach to avoid large spikes when inserting shapes. It not only has the advantage
/// of traditional SAP approch which is good for when many objects are sleeping, but due to being fully parallel,
/// it also is great when lots of shapes are moving or for runtime pair insertion and removal. It can become a
/// performance bottleneck if there are a very large number of shapes roughly projecting to the same values
/// on a given axis. If the scene has a very large number of shapes in an actor, e.g. a humanoid, it is recommended
/// to use an aggregate to represent multi-shape or multi-body actors to minimize stress placed on the broad phase.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum PxBroadPhaseType {
/// 3-axes sweep-and-prune
Sap = 0,
/// Multi box pruning
Mbp = 1,
/// Automatic box pruning
Abp = 2,
/// Parallel automatic box pruning
Pabp = 3,
/// GPU broad phase
Gpu = 4,
Last = 5,
}

View File

@@ -0,0 +1,11 @@
---
source: physx-sys/pxbind/tests/enums.rs
expression: "gen_enums(\"simple.h\", &[]).unwrap()"
---
/// enum for empty constructor tag
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum PxEMPTY {
PxEmpty = 0,
}

View File

@@ -0,0 +1,56 @@
---
source: physx-sys/pxbind/tests/enums.rs
expression: "gen_enums(\"u32.h\", &[]).unwrap()"
---
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u32)]
pub enum PxThreadPriority {
/// High priority
High = 0,
/// Above Normal priority
AboveNormal = 1,
/// Normal/default priority
Normal = 2,
/// Below Normal priority
BelowNormal = 3,
/// Low priority.
Low = 4,
ForceDword = 4294967295,
}
/// Flags which affect the behavior of PxShapes.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum PxShapeFlag {
/// The shape will partake in collision in the physical simulation.
///
/// It is illegal to raise the eSIMULATION_SHAPE and eTRIGGER_SHAPE flags.
/// In the event that one of these flags is already raised the sdk will reject any
/// attempt to raise the other. To raise the eSIMULATION_SHAPE first ensure that
/// eTRIGGER_SHAPE is already lowered.
///
/// This flag has no effect if simulation is disabled for the corresponding actor (see [`PxActorFlag::eDISABLE_SIMULATION`]).
SimulationShape = 1,
/// The shape will partake in scene queries (ray casts, overlap tests, sweeps, ...).
SceneQueryShape = 2,
/// The shape is a trigger which can send reports whenever other shapes enter/leave its volume.
///
/// Triangle meshes and heightfields can not be triggers. Shape creation will fail in these cases.
///
/// Shapes marked as triggers do not collide with other objects. If an object should act both
/// as a trigger shape and a collision shape then create a rigid body with two shapes, one being a
/// trigger shape and the other a collision shape. It is illegal to raise the eTRIGGER_SHAPE and
/// eSIMULATION_SHAPE flags on a single PxShape instance. In the event that one of these flags is already
/// raised the sdk will reject any attempt to raise the other. To raise the eTRIGGER_SHAPE flag first
/// ensure that eSIMULATION_SHAPE flag is already lowered.
///
/// Trigger shapes will no longer send notification events for interactions with other trigger shapes.
///
/// Shapes marked as triggers are allowed to participate in scene queries, provided the eSCENE_QUERY_SHAPE flag is set.
///
/// This flag has no effect if simulation is disabled for the corresponding actor (see [`PxActorFlag::eDISABLE_SIMULATION`]).
TriggerShape = 4,
/// Enable debug renderer for this shape
Visualization = 8,
}

View File

@@ -0,0 +1,73 @@
---
source: physx-sys/pxbind/tests/functions.rs
expression: mo.rust
---
extern "C" {
/// Creates a collection object.
///
/// Objects can only be serialized or deserialized through a collection.
/// For serialization, users must add objects to the collection and serialize the collection as a whole.
/// For deserialization, the system gives back a collection of deserialized objects to users.
///
/// The new collection object.
pub fn phys_PxCreateCollection() -> *mut PxCollection;
pub fn phys_PxGetAssertHandler() -> *mut PxAssertHandler;
pub fn phys_PxSetAssertHandler(handler: *mut PxAssertHandler);
/// Sets the bytes of the provided buffer to zero.
///
/// Pointer to memory block (same as input)
pub fn phys_PxMemZero(dest: *mut std::ffi::c_void, count: u32) -> *mut std::ffi::c_void;
/// Sets the bytes of the provided buffer to the specified value.
///
/// Pointer to memory block (same as input)
pub fn phys_PxMemSet(dest: *mut std::ffi::c_void, c: i32, count: u32) -> *mut std::ffi::c_void;
/// Copies the bytes of one memory block to another. The memory blocks must not overlap.
///
/// Use [`PxMemMove`] if memory blocks overlap.
///
/// Pointer to destination memory block
pub fn phys_PxMemCopy(dest: *mut std::ffi::c_void, src: *const std::ffi::c_void, count: u32) -> *mut std::ffi::c_void;
/// Copies the bytes of one memory block to another. The memory blocks can overlap.
///
/// Use [`PxMemCopy`] if memory blocks do not overlap.
///
/// Pointer to destination memory block
pub fn phys_PxMemMove(dest: *mut std::ffi::c_void, src: *const std::ffi::c_void, count: u32) -> *mut std::ffi::c_void;
/// Mark a specified amount of memory with 0xcd pattern. This is used to check that the meta data
/// definition for serialized classes is complete in checked builds.
pub fn phys_PxMarkSerializedMemory(ptr: *mut std::ffi::c_void, byteSize: u32);
/// For internal use
pub fn phys_PxCustomGeometry_getUniqueID() -> u32;
pub fn phys_PxGetAggregateFilterHint(type_: PxAggregateType, enableSelfCollision: bool) -> u32;
pub fn phys_PxGetAggregateSelfCollisionBit(hint: u32) -> u32;
pub fn phys_PxGetAggregateType(hint: u32) -> PxAggregateType;
/// Creates an instance of the physics SDK.
///
/// Creates an instance of this class. May not be a class member to avoid name mangling.
/// Pass the constant [`PX_PHYSICS_VERSION`] as the argument.
/// There may be only one instance of this class per process. Calling this method after an instance
/// has been created already will result in an error message and NULL will be returned.
///
/// Calling this will register all optional code modules (Articulations and HeightFields), preparing them for use.
/// If you do not need some of these modules, consider calling PxCreateBasePhysics() instead and registering needed
/// modules manually.
///
/// PxPhysics instance on success, NULL if operation failed
pub fn phys_PxCreatePhysics(version: u32, foundation: *mut PxFoundation, scale: *const PxTolerancesScale, trackOutstandingAllocations: bool, pvd: *mut PxPvd, omniPvd: *mut PxOmniPvd) -> *mut PxPhysics;
pub fn phys_PxGetPhysics() -> *mut PxPhysics;
}

View File

@@ -0,0 +1,87 @@
---
source: physx-sys/pxbind/tests/functions.rs
expression: mo.cpp
---
extern "C" {
physx_PxCollection_Pod* phys_PxCreateCollection() {
physx::PxCollection* return_val = PxCreateCollection();
auto return_val_pod = reinterpret_cast<physx_PxCollection_Pod*>(return_val);
return return_val_pod;
}
physx_PxAssertHandler_Pod* phys_PxGetAssertHandler() {
physx::PxAssertHandler& return_val = PxGetAssertHandler();
auto return_val_pod = reinterpret_cast<physx_PxAssertHandler_Pod*>(&return_val);
return return_val_pod;
}
void phys_PxSetAssertHandler(physx_PxAssertHandler_Pod* handler_pod) {
physx::PxAssertHandler& handler = reinterpret_cast<physx::PxAssertHandler&>(*handler_pod);
PxSetAssertHandler(handler);
}
void* phys_PxMemZero(void* dest, uint32_t count) {
void* return_val = PxMemZero(dest, count);
return return_val;
}
void* phys_PxMemSet(void* dest, int32_t c, uint32_t count) {
void* return_val = PxMemSet(dest, c, count);
return return_val;
}
void* phys_PxMemCopy(void* dest, void const* src, uint32_t count) {
void* return_val = PxMemCopy(dest, src, count);
return return_val;
}
void* phys_PxMemMove(void* dest, void const* src, uint32_t count) {
void* return_val = PxMemMove(dest, src, count);
return return_val;
}
void phys_PxMarkSerializedMemory(void* ptr, uint32_t byteSize) {
PxMarkSerializedMemory(ptr, byteSize);
}
uint32_t phys_PxCustomGeometry_getUniqueID() {
uint32_t return_val = PxCustomGeometry_getUniqueID();
return return_val;
}
uint32_t phys_PxGetAggregateFilterHint(int32_t type_pod, bool enableSelfCollision) {
auto type = static_cast<physx::PxAggregateType::Enum>(type_pod);
uint32_t return_val = PxGetAggregateFilterHint(type, enableSelfCollision);
return return_val;
}
uint32_t phys_PxGetAggregateSelfCollisionBit(uint32_t hint) {
uint32_t return_val = PxGetAggregateSelfCollisionBit(hint);
return return_val;
}
int32_t phys_PxGetAggregateType(uint32_t hint) {
physx::PxAggregateType::Enum return_val = PxGetAggregateType(hint);
int32_t return_val_pod;
memcpy(&return_val_pod, &return_val, sizeof(return_val_pod));
return return_val_pod;
}
physx_PxPhysics_Pod* phys_PxCreatePhysics(uint32_t version, physx_PxFoundation_Pod* foundation_pod, physx_PxTolerancesScale_Pod const* scale_pod, bool trackOutstandingAllocations, physx_PxPvd_Pod* pvd_pod, physx_PxOmniPvd_Pod* omniPvd_pod) {
physx::PxFoundation& foundation = reinterpret_cast<physx::PxFoundation&>(*foundation_pod);
physx::PxTolerancesScale const& scale = reinterpret_cast<physx::PxTolerancesScale const&>(*scale_pod);
physx::PxPvd* pvd = reinterpret_cast<physx::PxPvd*>(pvd_pod);
physx::PxOmniPvd* omniPvd = reinterpret_cast<physx::PxOmniPvd*>(omniPvd_pod);
physx::PxPhysics* return_val = PxCreatePhysics(version, foundation, scale, trackOutstandingAllocations, pvd, omniPvd);
auto return_val_pod = reinterpret_cast<physx_PxPhysics_Pod*>(return_val);
return return_val_pod;
}
physx_PxPhysics_Pod* phys_PxGetPhysics() {
physx::PxPhysics& return_val = PxGetPhysics();
auto return_val_pod = reinterpret_cast<physx_PxPhysics_Pod*>(&return_val);
return return_val_pod;
}
}

View File

@@ -0,0 +1,31 @@
---
source: physx-sys/pxbind/tests/methods.rs
expression: mo.rust
---
extern "C" {
pub fn PxFilterData_new(anon_param0: PxEMPTY) -> PxFilterData;
/// Default constructor.
pub fn PxFilterData_new_1() -> PxFilterData;
/// Constructor to set filter data initially.
pub fn PxFilterData_new_2(w0: u32, w1: u32, w2: u32, w3: u32) -> PxFilterData;
/// (re)sets the structure to the default.
pub fn PxFilterData_setToDefault_mut(self_: *mut PxFilterData);
/// constructor sets to default.
pub fn PxBoxControllerDesc_new_alloc() -> *mut PxBoxControllerDesc;
pub fn PxBoxControllerDesc_delete(self_: *mut PxBoxControllerDesc);
/// (re)sets the structure to the default.
pub fn PxBoxControllerDesc_setToDefault_mut(self_: *mut PxBoxControllerDesc);
/// returns true if the current settings are valid
///
/// True if the descriptor is valid.
pub fn PxBoxControllerDesc_isValid(self_: *const PxBoxControllerDesc) -> bool;
}

View File

@@ -0,0 +1,56 @@
---
source: physx-sys/pxbind/tests/methods.rs
expression: mo.cpp
---
extern "C" {
physx_PxFilterData_Pod PxFilterData_new(int32_t anon_param0_pod) {
auto anon_param0 = static_cast<physx::PxEMPTY>(anon_param0_pod);
PxFilterData return_val(anon_param0);
physx_PxFilterData_Pod return_val_pod;
memcpy(&return_val_pod, &return_val, sizeof(return_val_pod));
return return_val_pod;
}
physx_PxFilterData_Pod PxFilterData_new_1() {
PxFilterData return_val;
physx_PxFilterData_Pod return_val_pod;
memcpy(&return_val_pod, &return_val, sizeof(return_val_pod));
return return_val_pod;
}
physx_PxFilterData_Pod PxFilterData_new_2(uint32_t w0, uint32_t w1, uint32_t w2, uint32_t w3) {
PxFilterData return_val(w0, w1, w2, w3);
physx_PxFilterData_Pod return_val_pod;
memcpy(&return_val_pod, &return_val, sizeof(return_val_pod));
return return_val_pod;
}
void PxFilterData_setToDefault_mut(physx_PxFilterData_Pod* self__pod) {
physx::PxFilterData* self_ = reinterpret_cast<physx::PxFilterData*>(self__pod);
self_->setToDefault();
}
physx_PxBoxControllerDesc_Pod* PxBoxControllerDesc_new_alloc() {
auto return_val = new physx::PxBoxControllerDesc();
auto return_val_pod = reinterpret_cast<physx_PxBoxControllerDesc_Pod*>(return_val);
return return_val_pod;
}
void PxBoxControllerDesc_delete(physx_PxBoxControllerDesc_Pod* self__pod) {
physx::PxBoxControllerDesc* self_ = reinterpret_cast<physx::PxBoxControllerDesc*>(self__pod);
delete self_;
}
void PxBoxControllerDesc_setToDefault_mut(physx_PxBoxControllerDesc_Pod* self__pod) {
physx::PxBoxControllerDesc* self_ = reinterpret_cast<physx::PxBoxControllerDesc*>(self__pod);
self_->setToDefault();
}
bool PxBoxControllerDesc_isValid(physx_PxBoxControllerDesc_Pod const* self__pod) {
physx::PxBoxControllerDesc const* self_ = reinterpret_cast<physx::PxBoxControllerDesc const*>(self__pod);
bool return_val = self_->isValid();
return return_val;
}
}

View File

@@ -0,0 +1,25 @@
---
source: physx-sys/pxbind/tests/methods.rs
expression: mo.rust
---
extern "C" {
pub fn PxJointLimitParameters_new_alloc() -> *mut PxJointLimitParameters;
/// Returns true if the current settings are valid.
///
/// true if the current settings are valid
pub fn PxJointLimitParameters_isValid(self_: *const PxJointLimitParameters) -> bool;
pub fn PxJointLimitParameters_isSoft(self_: *const PxJointLimitParameters) -> bool;
pub fn PxJointAngularLimitPair_new(lowerLimit: f32, upperLimit: f32, contactDist_deprecated: f32) -> PxJointAngularLimitPair;
/// Returns true if the limit is valid.
///
/// true if the current settings are valid
pub fn PxJointAngularLimitPair_isValid(self_: *const PxJointAngularLimitPair) -> bool;
pub fn PxJointAngularLimitPair_delete(self_: *mut PxJointAngularLimitPair);
}

View File

@@ -0,0 +1,43 @@
---
source: physx-sys/pxbind/tests/methods.rs
expression: mo.cpp
---
extern "C" {
physx_PxJointLimitParameters_Pod* PxJointLimitParameters_new_alloc() {
auto return_val = new physx::PxJointLimitParameters();
auto return_val_pod = reinterpret_cast<physx_PxJointLimitParameters_Pod*>(return_val);
return return_val_pod;
}
bool PxJointLimitParameters_isValid(physx_PxJointLimitParameters_Pod const* self__pod) {
physx::PxJointLimitParameters const* self_ = reinterpret_cast<physx::PxJointLimitParameters const*>(self__pod);
bool return_val = self_->isValid();
return return_val;
}
bool PxJointLimitParameters_isSoft(physx_PxJointLimitParameters_Pod const* self__pod) {
physx::PxJointLimitParameters const* self_ = reinterpret_cast<physx::PxJointLimitParameters const*>(self__pod);
bool return_val = self_->isSoft();
return return_val;
}
physx_PxJointAngularLimitPair_Pod PxJointAngularLimitPair_new(float lowerLimit, float upperLimit, float contactDist_deprecated) {
PxJointAngularLimitPair return_val(lowerLimit, upperLimit, contactDist_deprecated);
physx_PxJointAngularLimitPair_Pod return_val_pod;
memcpy(&return_val_pod, &return_val, sizeof(return_val_pod));
return return_val_pod;
}
bool PxJointAngularLimitPair_isValid(physx_PxJointAngularLimitPair_Pod const* self__pod) {
physx::PxJointAngularLimitPair const* self_ = reinterpret_cast<physx::PxJointAngularLimitPair const*>(self__pod);
bool return_val = self_->isValid();
return return_val;
}
void PxJointAngularLimitPair_delete(physx_PxJointAngularLimitPair_Pod* self__pod) {
physx::PxJointAngularLimitPair* self_ = reinterpret_cast<physx::PxJointAngularLimitPair*>(self__pod);
delete self_;
}
}

View File

@@ -0,0 +1,260 @@
---
source: physx-sys/pxbind/tests/methods.rs
expression: mo.rust
---
extern "C" {
/// Decrements the reference count of a shape and releases it if the new reference count is zero.
///
/// Note that in releases prior to PhysX 3.3 this method did not have reference counting semantics and was used to destroy a shape
/// created with PxActor::createShape(). In PhysX 3.3 and above, this usage is deprecated, instead, use PxRigidActor::detachShape() to detach
/// a shape from an actor. If the shape to be detached was created with PxActor::createShape(), the actor holds the only counted reference,
/// and so when the shape is detached it will also be destroyed.
pub fn PxShape_release_mut(self_: *mut PxShape);
/// Adjust the geometry of the shape.
///
/// The type of the passed in geometry must match the geometry type of the shape.
///
/// It is not allowed to change the geometry type of a shape.
///
/// This function does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry.
pub fn PxShape_setGeometry_mut(self_: *mut PxShape, geometry: *const PxGeometry);
/// Retrieve a reference to the shape's geometry.
///
/// The returned reference has the same lifetime as the PxShape it comes from.
///
/// Reference to internal PxGeometry object.
pub fn PxShape_getGeometry(self_: *const PxShape) -> *const PxGeometry;
/// Retrieves the actor which this shape is associated with.
///
/// The actor this shape is associated with, if it is an exclusive shape, else NULL
pub fn PxShape_getActor(self_: *const PxShape) -> *mut PxRigidActor;
/// Sets the pose of the shape in actor space, i.e. relative to the actors to which they are attached.
///
/// This transformation is identity by default.
///
/// The local pose is an attribute of the shape, and so will apply to all actors to which the shape is attached.
///
/// Sleeping:
/// Does
/// NOT
/// wake the associated actor up automatically.
///
/// Note:
/// Does not automatically update the inertia properties of the owning actor (if applicable); use the
/// PhysX extensions method [`PxRigidBodyExt::updateMassAndInertia`]() to do this.
///
/// Default:
/// the identity transform
pub fn PxShape_setLocalPose_mut(self_: *mut PxShape, pose: *const PxTransform);
/// Retrieves the pose of the shape in actor space, i.e. relative to the actor they are owned by.
///
/// This transformation is identity by default.
///
/// Pose of shape relative to the actor's frame.
pub fn PxShape_getLocalPose(self_: *const PxShape) -> PxTransform;
/// Sets the user definable collision filter data.
///
/// Sleeping:
/// Does wake up the actor if the filter data change causes a formerly suppressed
/// collision pair to be enabled.
///
/// Default:
/// (0,0,0,0)
pub fn PxShape_setSimulationFilterData_mut(self_: *mut PxShape, data: *const PxFilterData);
/// Retrieves the shape's collision filter data.
pub fn PxShape_getSimulationFilterData(self_: *const PxShape) -> PxFilterData;
/// Sets the user definable query filter data.
///
/// Default:
/// (0,0,0,0)
pub fn PxShape_setQueryFilterData_mut(self_: *mut PxShape, data: *const PxFilterData);
/// Retrieves the shape's Query filter data.
pub fn PxShape_getQueryFilterData(self_: *const PxShape) -> PxFilterData;
/// Assigns material(s) to the shape. Will remove existing materials from the shape.
///
/// Sleeping:
/// Does
/// NOT
/// wake the associated actor up automatically.
pub fn PxShape_setMaterials_mut(self_: *mut PxShape, materials: *const *mut PxMaterial, materialCount: u16);
/// Returns the number of materials assigned to the shape.
///
/// You can use [`getMaterials`]() to retrieve the material pointers.
///
/// Number of materials associated with this shape.
pub fn PxShape_getNbMaterials(self_: *const PxShape) -> u16;
/// Retrieve all the material pointers associated with the shape.
///
/// You can retrieve the number of material pointers by calling [`getNbMaterials`]()
///
/// Note: The returned data may contain invalid pointers if you release materials using [`PxMaterial::release`]().
///
/// Number of material pointers written to the buffer.
pub fn PxShape_getMaterials(self_: *const PxShape, userBuffer: *mut *mut PxMaterial, bufferSize: u32, startIndex: u32) -> u32;
/// Retrieve material from given triangle index.
///
/// The input index is the internal triangle index as used inside the SDK. This is the index
/// returned to users by various SDK functions such as raycasts.
///
/// This function is only useful for triangle meshes or heightfields, which have per-triangle
/// materials. For other shapes or SDF triangle meshes, the function returns the single material
/// associated with the shape, regardless of the index.
///
/// Material from input triangle
///
/// If faceIndex value of 0xFFFFffff is passed as an input for mesh and heightfield shapes, this function will issue a warning and return NULL.
///
/// Scene queries set the value of PxQueryHit::faceIndex to 0xFFFFffff whenever it is undefined or does not apply.
pub fn PxShape_getMaterialFromInternalFaceIndex(self_: *const PxShape, faceIndex: u32) -> *mut PxBaseMaterial;
/// Sets the contact offset.
///
/// Shapes whose distance is less than the sum of their contactOffset values will generate contacts. The contact offset must be positive and
/// greater than the rest offset. Having a contactOffset greater than than the restOffset allows the collision detection system to
/// predictively enforce the contact constraint even when the objects are slightly separated. This prevents jitter that would occur
/// if the constraint were enforced only when shapes were within the rest distance.
///
/// Default:
/// 0.02f * PxTolerancesScale::length
///
/// Sleeping:
/// Does
/// NOT
/// wake the associated actor up automatically.
pub fn PxShape_setContactOffset_mut(self_: *mut PxShape, contactOffset: f32);
/// Retrieves the contact offset.
///
/// The contact offset of the shape.
pub fn PxShape_getContactOffset(self_: *const PxShape) -> f32;
/// Sets the rest offset.
///
/// Two shapes will come to rest at a distance equal to the sum of their restOffset values. If the restOffset is 0, they should converge to touching
/// exactly. Having a restOffset greater than zero is useful to have objects slide smoothly, so that they do not get hung up on irregularities of
/// each others' surfaces.
///
/// Default:
/// 0.0f
///
/// Sleeping:
/// Does
/// NOT
/// wake the associated actor up automatically.
pub fn PxShape_setRestOffset_mut(self_: *mut PxShape, restOffset: f32);
/// Retrieves the rest offset.
///
/// The rest offset of the shape.
pub fn PxShape_getRestOffset(self_: *const PxShape) -> f32;
/// Sets the density used to interact with fluids.
///
/// To be physically accurate, the density of a rigid body should be computed as its mass divided by its volume. To
/// simplify tuning the interaction of fluid and rigid bodies, the density for fluid can differ from the real density. This
/// allows to create floating bodies, even if they are supposed to sink with their mass and volume.
///
/// Default:
/// 800.0f
pub fn PxShape_setDensityForFluid_mut(self_: *mut PxShape, densityForFluid: f32);
/// Retrieves the density used to interact with fluids.
///
/// The density of the body when interacting with fluid.
pub fn PxShape_getDensityForFluid(self_: *const PxShape) -> f32;
/// Sets torsional patch radius.
///
/// This defines the radius of the contact patch used to apply torsional friction. If the radius is 0, no torsional friction
/// will be applied. If the radius is > 0, some torsional friction will be applied. This is proportional to the penetration depth
/// so, if the shapes are separated or penetration is zero, no torsional friction will be applied. It is used to approximate
/// rotational friction introduced by the compression of contacting surfaces.
///
/// Default:
/// 0.0
pub fn PxShape_setTorsionalPatchRadius_mut(self_: *mut PxShape, radius: f32);
/// Gets torsional patch radius.
///
/// This defines the radius of the contact patch used to apply torsional friction. If the radius is 0, no torsional friction
/// will be applied. If the radius is > 0, some torsional friction will be applied. This is proportional to the penetration depth
/// so, if the shapes are separated or penetration is zero, no torsional friction will be applied. It is used to approximate
/// rotational friction introduced by the compression of contacting surfaces.
///
/// The torsional patch radius of the shape.
pub fn PxShape_getTorsionalPatchRadius(self_: *const PxShape) -> f32;
/// Sets minimum torsional patch radius.
///
/// This defines the minimum radius of the contact patch used to apply torsional friction. If the radius is 0, the amount of torsional friction
/// that will be applied will be entirely dependent on the value of torsionalPatchRadius.
///
/// If the radius is > 0, some torsional friction will be applied regardless of the value of torsionalPatchRadius or the amount of penetration.
///
/// Default:
/// 0.0
pub fn PxShape_setMinTorsionalPatchRadius_mut(self_: *mut PxShape, radius: f32);
/// Gets minimum torsional patch radius.
///
/// This defines the minimum radius of the contact patch used to apply torsional friction. If the radius is 0, the amount of torsional friction
/// that will be applied will be entirely dependent on the value of torsionalPatchRadius.
///
/// If the radius is > 0, some torsional friction will be applied regardless of the value of torsionalPatchRadius or the amount of penetration.
///
/// The minimum torsional patch radius of the shape.
pub fn PxShape_getMinTorsionalPatchRadius(self_: *const PxShape) -> f32;
/// Sets shape flags
///
/// Sleeping:
/// Does
/// NOT
/// wake the associated actor up automatically.
///
/// Default:
/// PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eSCENE_QUERY_SHAPE
pub fn PxShape_setFlag_mut(self_: *mut PxShape, flag: PxShapeFlag, value: bool);
/// Sets shape flags
pub fn PxShape_setFlags_mut(self_: *mut PxShape, inFlags: PxShapeFlags);
/// Retrieves shape flags.
///
/// The values of the shape flags.
pub fn PxShape_getFlags(self_: *const PxShape) -> PxShapeFlags;
/// Returns true if the shape is exclusive to an actor.
pub fn PxShape_isExclusive(self_: *const PxShape) -> bool;
/// Sets a name string for the object that can be retrieved with [`getName`]().
///
/// This is for debugging and is not used by the SDK.
/// The string is not copied by the SDK, only the pointer is stored.
///
/// Default:
/// NULL
pub fn PxShape_setName_mut(self_: *mut PxShape, name: *const std::ffi::c_char);
/// retrieves the name string set with setName().
///
/// The name associated with the shape.
pub fn PxShape_getName(self_: *const PxShape) -> *const std::ffi::c_char;
pub fn PxShape_getConcreteTypeName(self_: *const PxShape) -> *const std::ffi::c_char;
}

View File

@@ -0,0 +1,198 @@
---
source: physx-sys/pxbind/tests/methods.rs
expression: mo.cpp
---
extern "C" {
void PxShape_release_mut(physx_PxShape_Pod* self__pod) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
self_->release();
}
void PxShape_setGeometry_mut(physx_PxShape_Pod* self__pod, physx_PxGeometry_Pod const* geometry_pod) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
physx::PxGeometry const& geometry = reinterpret_cast<physx::PxGeometry const&>(*geometry_pod);
self_->setGeometry(geometry);
}
physx_PxGeometry_Pod const* PxShape_getGeometry(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
physx::PxGeometry const& return_val = self_->getGeometry();
auto return_val_pod = reinterpret_cast<physx_PxGeometry_Pod const*>(&return_val);
return return_val_pod;
}
physx_PxRigidActor_Pod* PxShape_getActor(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
physx::PxRigidActor* return_val = self_->getActor();
auto return_val_pod = reinterpret_cast<physx_PxRigidActor_Pod*>(return_val);
return return_val_pod;
}
void PxShape_setLocalPose_mut(physx_PxShape_Pod* self__pod, physx_PxTransform_Pod const* pose_pod) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
physx::PxTransform const& pose = reinterpret_cast<physx::PxTransform const&>(*pose_pod);
self_->setLocalPose(pose);
}
physx_PxTransform_Pod PxShape_getLocalPose(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
physx::PxTransform return_val = self_->getLocalPose();
physx_PxTransform_Pod return_val_pod;
memcpy(&return_val_pod, &return_val, sizeof(return_val_pod));
return return_val_pod;
}
void PxShape_setSimulationFilterData_mut(physx_PxShape_Pod* self__pod, physx_PxFilterData_Pod const* data_pod) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
physx::PxFilterData const& data = reinterpret_cast<physx::PxFilterData const&>(*data_pod);
self_->setSimulationFilterData(data);
}
physx_PxFilterData_Pod PxShape_getSimulationFilterData(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
physx::PxFilterData return_val = self_->getSimulationFilterData();
physx_PxFilterData_Pod return_val_pod;
memcpy(&return_val_pod, &return_val, sizeof(return_val_pod));
return return_val_pod;
}
void PxShape_setQueryFilterData_mut(physx_PxShape_Pod* self__pod, physx_PxFilterData_Pod const* data_pod) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
physx::PxFilterData const& data = reinterpret_cast<physx::PxFilterData const&>(*data_pod);
self_->setQueryFilterData(data);
}
physx_PxFilterData_Pod PxShape_getQueryFilterData(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
physx::PxFilterData return_val = self_->getQueryFilterData();
physx_PxFilterData_Pod return_val_pod;
memcpy(&return_val_pod, &return_val, sizeof(return_val_pod));
return return_val_pod;
}
void PxShape_setMaterials_mut(physx_PxShape_Pod* self__pod, physx_PxMaterial_Pod* const* materials_pod, uint16_t materialCount) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
physx::PxMaterial* const* materials = reinterpret_cast<physx::PxMaterial* const*>(materials_pod);
self_->setMaterials(materials, materialCount);
}
uint16_t PxShape_getNbMaterials(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
uint16_t return_val = self_->getNbMaterials();
return return_val;
}
uint32_t PxShape_getMaterials(physx_PxShape_Pod const* self__pod, physx_PxMaterial_Pod** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
physx::PxMaterial** userBuffer = reinterpret_cast<physx::PxMaterial**>(userBuffer_pod);
uint32_t return_val = self_->getMaterials(userBuffer, bufferSize, startIndex);
return return_val;
}
physx_PxBaseMaterial_Pod* PxShape_getMaterialFromInternalFaceIndex(physx_PxShape_Pod const* self__pod, uint32_t faceIndex) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
physx::PxBaseMaterial* return_val = self_->getMaterialFromInternalFaceIndex(faceIndex);
auto return_val_pod = reinterpret_cast<physx_PxBaseMaterial_Pod*>(return_val);
return return_val_pod;
}
void PxShape_setContactOffset_mut(physx_PxShape_Pod* self__pod, float contactOffset) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
self_->setContactOffset(contactOffset);
}
float PxShape_getContactOffset(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
float return_val = self_->getContactOffset();
return return_val;
}
void PxShape_setRestOffset_mut(physx_PxShape_Pod* self__pod, float restOffset) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
self_->setRestOffset(restOffset);
}
float PxShape_getRestOffset(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
float return_val = self_->getRestOffset();
return return_val;
}
void PxShape_setDensityForFluid_mut(physx_PxShape_Pod* self__pod, float densityForFluid) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
self_->setDensityForFluid(densityForFluid);
}
float PxShape_getDensityForFluid(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
float return_val = self_->getDensityForFluid();
return return_val;
}
void PxShape_setTorsionalPatchRadius_mut(physx_PxShape_Pod* self__pod, float radius) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
self_->setTorsionalPatchRadius(radius);
}
float PxShape_getTorsionalPatchRadius(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
float return_val = self_->getTorsionalPatchRadius();
return return_val;
}
void PxShape_setMinTorsionalPatchRadius_mut(physx_PxShape_Pod* self__pod, float radius) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
self_->setMinTorsionalPatchRadius(radius);
}
float PxShape_getMinTorsionalPatchRadius(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
float return_val = self_->getMinTorsionalPatchRadius();
return return_val;
}
void PxShape_setFlag_mut(physx_PxShape_Pod* self__pod, int32_t flag_pod, bool value) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
auto flag = static_cast<physx::PxShapeFlag::Enum>(flag_pod);
self_->setFlag(flag, value);
}
void PxShape_setFlags_mut(physx_PxShape_Pod* self__pod, uint8_t inFlags_pod) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
auto inFlags = physx::PxShapeFlags(inFlags_pod);
self_->setFlags(inFlags);
}
uint8_t PxShape_getFlags(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
physx::PxShapeFlags return_val = self_->getFlags();
uint8_t return_val_pod;
memcpy(&return_val_pod, &return_val, sizeof(return_val_pod));
return return_val_pod;
}
bool PxShape_isExclusive(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
bool return_val = self_->isExclusive();
return return_val;
}
void PxShape_setName_mut(physx_PxShape_Pod* self__pod, char const* name) {
physx::PxShape* self_ = reinterpret_cast<physx::PxShape*>(self__pod);
self_->setName(name);
}
char const* PxShape_getName(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
char const* return_val = self_->getName();
return return_val;
}
char const* PxShape_getConcreteTypeName(physx_PxShape_Pod const* self__pod) {
physx::PxShape const* self_ = reinterpret_cast<physx::PxShape const*>(self__pod);
char const* return_val = self_->getConcreteTypeName();
return return_val;
}
}

View File

@@ -0,0 +1,10 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.size_asserts
---
using namespace physx;
#include "structgen_out.hpp"
static_assert(sizeof(physx::PxAllocatorCallback) == sizeof(physx_PxAllocatorCallback_Pod), "POD wrapper for `physx::PxAllocatorCallback` has incorrect size");

View File

@@ -0,0 +1,12 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.rust_decls
---
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxAllocatorCallback {
vtable_: *const std::ffi::c_void,
}

View File

@@ -0,0 +1,18 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.structgen
---
// Automatically generated by pxbind
#include "PxPhysicsAPI.h"
using namespace physx;
#define unsafe_offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
#include "structgen.hpp"
int main() {
PodStructGen sg;
sg.pass_thru("struct physx_PxAllocatorCallback_Pod {\n void* vtable_;\n};\n");
sg.finish();
}

View File

@@ -0,0 +1,47 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.size_asserts
---
using namespace physx;
#include "structgen_out.hpp"
static_assert(sizeof(physx::PxAssertHandler) == sizeof(physx_PxAssertHandler_Pod), "POD wrapper for `physx::PxAssertHandler` has incorrect size");
static_assert(sizeof(physx::PxVec3) == sizeof(physx_PxVec3_Pod), "POD wrapper for `physx::PxVec3` has incorrect size");
static_assert(sizeof(physx::PxVec3Padded) == sizeof(physx_PxVec3Padded_Pod), "POD wrapper for `physx::PxVec3Padded` has incorrect size");
static_assert(sizeof(physx::PxQuat) == sizeof(physx_PxQuat_Pod), "POD wrapper for `physx::PxQuat` has incorrect size");
static_assert(sizeof(physx::PxMat33) == sizeof(physx_PxMat33_Pod), "POD wrapper for `physx::PxMat33` has incorrect size");
static_assert(sizeof(physx::PxTransform) == sizeof(physx_PxTransform_Pod), "POD wrapper for `physx::PxTransform` has incorrect size");
static_assert(sizeof(physx::PxTransformPadded) == sizeof(physx_PxTransformPadded_Pod), "POD wrapper for `physx::PxTransformPadded` has incorrect size");
static_assert(sizeof(physx::PxProcessPxBaseCallback) == sizeof(physx_PxProcessPxBaseCallback_Pod), "POD wrapper for `physx::PxProcessPxBaseCallback` has incorrect size");
static_assert(sizeof(physx::PxSerializationContext) == sizeof(physx_PxSerializationContext_Pod), "POD wrapper for `physx::PxSerializationContext` has incorrect size");
static_assert(sizeof(physx::PxDeserializationContext) == sizeof(physx_PxDeserializationContext_Pod), "POD wrapper for `physx::PxDeserializationContext` has incorrect size");
static_assert(sizeof(physx::PxSerializationRegistry) == sizeof(physx_PxSerializationRegistry_Pod), "POD wrapper for `physx::PxSerializationRegistry` has incorrect size");
static_assert(sizeof(physx::PxCollection) == sizeof(physx_PxCollection_Pod), "POD wrapper for `physx::PxCollection` has incorrect size");
static_assert(sizeof(physx::PxBase) == sizeof(physx_PxBase_Pod), "POD wrapper for `physx::PxBase` has incorrect size");
static_assert(sizeof(physx::PxRefCounted) == sizeof(physx_PxRefCounted_Pod), "POD wrapper for `physx::PxRefCounted` has incorrect size");
static_assert(sizeof(physx::PxSpringModifiers) == sizeof(physx_PxSpringModifiers_Pod), "POD wrapper for `physx::PxSpringModifiers` has incorrect size");
static_assert(sizeof(physx::PxRestitutionModifiers) == sizeof(physx_PxRestitutionModifiers_Pod), "POD wrapper for `physx::PxRestitutionModifiers` has incorrect size");
static_assert(sizeof(physx::Px1DConstraintMods) == sizeof(physx_Px1DConstraintMods_Pod), "POD wrapper for `physx::Px1DConstraintMods` has incorrect size");
static_assert(sizeof(physx::Px1DConstraint) == sizeof(physx_Px1DConstraint_Pod), "POD wrapper for `physx::Px1DConstraint` has incorrect size");
static_assert(sizeof(physx::PxConstraintInvMassScale) == sizeof(physx_PxConstraintInvMassScale_Pod), "POD wrapper for `physx::PxConstraintInvMassScale` has incorrect size");
static_assert(sizeof(physx::PxConstraintVisualizer) == sizeof(physx_PxConstraintVisualizer_Pod), "POD wrapper for `physx::PxConstraintVisualizer` has incorrect size");
static_assert(sizeof(physx::PxConstraintConnector) == sizeof(physx_PxConstraintConnector_Pod), "POD wrapper for `physx::PxConstraintConnector` has incorrect size");
static_assert(sizeof(physx::PxContactPoint) == sizeof(physx_PxContactPoint_Pod), "POD wrapper for `physx::PxContactPoint` has incorrect size");
static_assert(sizeof(physx::PxSolverBody) == sizeof(physx_PxSolverBody_Pod), "POD wrapper for `physx::PxSolverBody` has incorrect size");
static_assert(sizeof(physx::PxSolverBodyData) == sizeof(physx_PxSolverBodyData_Pod), "POD wrapper for `physx::PxSolverBodyData` has incorrect size");
static_assert(sizeof(physx::PxConstraintBatchHeader) == sizeof(physx_PxConstraintBatchHeader_Pod), "POD wrapper for `physx::PxConstraintBatchHeader` has incorrect size");
static_assert(sizeof(physx::PxSolverConstraintDesc) == sizeof(physx_PxSolverConstraintDesc_Pod), "POD wrapper for `physx::PxSolverConstraintDesc` has incorrect size");
static_assert(sizeof(physx::PxSolverConstraintPrepDescBase) == sizeof(physx_PxSolverConstraintPrepDescBase_Pod), "POD wrapper for `physx::PxSolverConstraintPrepDescBase` has incorrect size");
static_assert(sizeof(physx::PxSolverConstraintPrepDesc) == sizeof(physx_PxSolverConstraintPrepDesc_Pod), "POD wrapper for `physx::PxSolverConstraintPrepDesc` has incorrect size");
static_assert(sizeof(physx::PxSolverContactDesc) == sizeof(physx_PxSolverContactDesc_Pod), "POD wrapper for `physx::PxSolverContactDesc` has incorrect size");
static_assert(sizeof(physx::PxConstraintAllocator) == sizeof(physx_PxConstraintAllocator_Pod), "POD wrapper for `physx::PxConstraintAllocator` has incorrect size");
static_assert(sizeof(physx::PxArticulationLimit) == sizeof(physx_PxArticulationLimit_Pod), "POD wrapper for `physx::PxArticulationLimit` has incorrect size");
static_assert(sizeof(physx::PxArticulationDrive) == sizeof(physx_PxArticulationDrive_Pod), "POD wrapper for `physx::PxArticulationDrive` has incorrect size");
static_assert(sizeof(physx::PxTGSSolverBodyVel) == sizeof(physx_PxTGSSolverBodyVel_Pod), "POD wrapper for `physx::PxTGSSolverBodyVel` has incorrect size");
static_assert(sizeof(physx::PxTGSSolverBodyTxInertia) == sizeof(physx_PxTGSSolverBodyTxInertia_Pod), "POD wrapper for `physx::PxTGSSolverBodyTxInertia` has incorrect size");
static_assert(sizeof(physx::PxTGSSolverBodyData) == sizeof(physx_PxTGSSolverBodyData_Pod), "POD wrapper for `physx::PxTGSSolverBodyData` has incorrect size");
static_assert(sizeof(physx::PxTGSSolverConstraintPrepDescBase) == sizeof(physx_PxTGSSolverConstraintPrepDescBase_Pod), "POD wrapper for `physx::PxTGSSolverConstraintPrepDescBase` has incorrect size");
static_assert(sizeof(physx::PxTGSSolverConstraintPrepDesc) == sizeof(physx_PxTGSSolverConstraintPrepDesc_Pod), "POD wrapper for `physx::PxTGSSolverConstraintPrepDesc` has incorrect size");
static_assert(sizeof(physx::PxTGSSolverContactDesc) == sizeof(physx_PxTGSSolverContactDesc_Pod), "POD wrapper for `physx::PxTGSSolverContactDesc` has incorrect size");

View File

@@ -0,0 +1,386 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.rust_decls
---
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxAllocatorCallback {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxErrorCallback {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxInputStream {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxInputData {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxOutputStream {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxVec2 {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxVec4 {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxMat34 {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxMat44 {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxPlane {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxBounds3 {
_unused: [u8; 0],
}
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxAssertHandler {
vtable_: *const std::ffi::c_void,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxRepXSerializer {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxSerializer {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxPhysics {
_unused: [u8; 0],
}
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxProcessPxBaseCallback {
vtable_: *const std::ffi::c_void,
}
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxSerializationContext {
vtable_: *const std::ffi::c_void,
}
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxSerializationRegistry {
vtable_: *const std::ffi::c_void,
}
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxCollection {
vtable_: *const std::ffi::c_void,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxTypeInfo {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxMaterial {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxFEMSoftBodyMaterial {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxFEMClothMaterial {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxPBDMaterial {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxFLIPMaterial {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxMPMMaterial {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxCustomMaterial {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxConvexMesh {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxTriangleMesh {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxBVH33TriangleMesh {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxBVH34TriangleMesh {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxTetrahedronMesh {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxHeightField {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxActor {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxRigidActor {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxRigidBody {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxRigidDynamic {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxRigidStatic {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxArticulationLink {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxArticulationJointReducedCoordinate {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxArticulationReducedCoordinate {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxAggregate {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxConstraint {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxShape {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxPruningStructure {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxParticleSystem {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxPBDParticleSystem {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxFLIPParticleSystem {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxMPMParticleSystem {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxCustomParticleSystem {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxSoftBody {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxFEMCloth {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxHairSystem {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxParticleBuffer {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxParticleAndDiffuseBuffer {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxParticleClothBuffer {
_unused: [u8; 0],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct PxParticleRigidBuffer {
_unused: [u8; 0],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub union Px1DConstraintMods {
pub spring: PxSpringModifiers,
pub bounce: PxRestitutionModifiers,
}
#[cfg(feature = "debug-structs")]
impl std::fmt::Debug for Px1DConstraintMods {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("Px1DConstraintMods")
}
}
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxConstraintVisualizer {
vtable_: *const std::ffi::c_void,
}
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxConstraintConnector {
vtable_: *const std::ffi::c_void,
}
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxConstraintAllocator {
vtable_: *const std::ffi::c_void,
}

View File

@@ -0,0 +1,552 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.structgen
---
// Automatically generated by pxbind
#include "PxPhysicsAPI.h"
using namespace physx;
#define unsafe_offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
#include "structgen.hpp"
int main() {
PodStructGen sg;
sg.pass_thru("struct physx_PxAllocatorCallback_Pod;\n");
sg.pass_thru("struct physx_PxErrorCallback_Pod;\n");
sg.pass_thru("struct physx_PxAssertHandler_Pod;\n");
sg.pass_thru("struct physx_PxInputStream_Pod;\n");
sg.pass_thru("struct physx_PxInputData_Pod;\n");
sg.pass_thru("struct physx_PxOutputStream_Pod;\n");
sg.pass_thru("struct physx_PxVec2_Pod;\n");
sg.pass_thru("struct physx_PxVec3_Pod;\n");
sg.pass_thru("struct physx_PxVec4_Pod;\n");
sg.pass_thru("struct physx_PxQuat_Pod;\n");
sg.pass_thru("struct physx_PxMat33_Pod;\n");
sg.pass_thru("struct physx_PxMat34_Pod;\n");
sg.pass_thru("struct physx_PxMat44_Pod;\n");
sg.pass_thru("struct physx_PxTransform_Pod;\n");
sg.pass_thru("struct physx_PxPlane_Pod;\n");
sg.pass_thru("struct physx_PxBounds3_Pod;\n");
sg.pass_thru("struct physx_PxAssertHandler_Pod {\n void* vtable_;\n};\n");
struct physx_PxVec3_Pod: public physx::PxVec3 {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxVec3_Pod", "PxVec3");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3_Pod, z));
sg.end_struct(sizeof(physx::PxVec3));
}
};
physx_PxVec3_Pod::dump_layout(sg);
struct physx_PxVec3Padded_Pod: public physx::PxVec3Padded {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxVec3Padded_Pod", "PxVec3Padded");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3Padded_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3Padded_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3Padded_Pod, z));
sg.add_field("uint32_t padding", "padding", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxVec3Padded_Pod, padding));
sg.end_struct(sizeof(physx::PxVec3Padded));
}
};
physx_PxVec3Padded_Pod::dump_layout(sg);
struct physx_PxQuat_Pod: public physx::PxQuat {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxQuat_Pod", "PxQuat");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, z));
sg.add_field("float w", "w", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, w));
sg.end_struct(sizeof(physx::PxQuat));
}
};
physx_PxQuat_Pod::dump_layout(sg);
struct physx_PxMat33_Pod: public physx::PxMat33 {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxMat33_Pod", "PxMat33");
sg.add_field("physx_PxVec3_Pod column0", "column0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxMat33_Pod, column0));
sg.add_field("physx_PxVec3_Pod column1", "column1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxMat33_Pod, column1));
sg.add_field("physx_PxVec3_Pod column2", "column2", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxMat33_Pod, column2));
sg.end_struct(sizeof(physx::PxMat33));
}
};
physx_PxMat33_Pod::dump_layout(sg);
struct physx_PxTransform_Pod: public physx::PxTransform {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTransform_Pod", "PxTransform");
sg.add_field("physx_PxQuat_Pod q", "q", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxTransform_Pod, q));
sg.add_field("physx_PxVec3_Pod p", "p", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxTransform_Pod, p));
sg.end_struct(sizeof(physx::PxTransform));
}
};
physx_PxTransform_Pod::dump_layout(sg);
struct physx_PxTransformPadded_Pod: public physx::PxTransformPadded {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTransformPadded_Pod", "PxTransformPadded");
sg.add_field("physx_PxTransform_Pod transform", "transform", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxTransformPadded_Pod, transform));
sg.add_field("uint32_t padding", "padding", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTransformPadded_Pod, padding));
sg.end_struct(sizeof(physx::PxTransformPadded));
}
};
physx_PxTransformPadded_Pod::dump_layout(sg);
sg.pass_thru("struct physx_PxBase_Pod;\n");
sg.pass_thru("struct physx_PxSerializationContext_Pod;\n");
sg.pass_thru("struct physx_PxRepXSerializer_Pod;\n");
sg.pass_thru("struct physx_PxSerializer_Pod;\n");
sg.pass_thru("struct physx_PxPhysics_Pod;\n");
sg.pass_thru("struct physx_PxCollection_Pod;\n");
sg.pass_thru("struct physx_PxProcessPxBaseCallback_Pod {\n void* vtable_;\n};\n");
sg.pass_thru("struct physx_PxSerializationContext_Pod {\n void* vtable_;\n};\n");
struct physx_PxDeserializationContext_Pod: public physx::PxDeserializationContext {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxDeserializationContext_Pod", "PxDeserializationContext");
sg.end_struct(sizeof(physx::PxDeserializationContext));
}
};
physx_PxDeserializationContext_Pod::dump_layout(sg);
sg.pass_thru("struct physx_PxSerializationRegistry_Pod {\n void* vtable_;\n};\n");
sg.pass_thru("struct physx_PxCollection_Pod {\n void* vtable_;\n};\n");
sg.pass_thru("struct physx_PxTypeInfo_Pod;\n");
sg.pass_thru("struct physx_PxMaterial_Pod;\n");
sg.pass_thru("struct physx_PxFEMSoftBodyMaterial_Pod;\n");
sg.pass_thru("struct physx_PxFEMClothMaterial_Pod;\n");
sg.pass_thru("struct physx_PxPBDMaterial_Pod;\n");
sg.pass_thru("struct physx_PxFLIPMaterial_Pod;\n");
sg.pass_thru("struct physx_PxMPMMaterial_Pod;\n");
sg.pass_thru("struct physx_PxCustomMaterial_Pod;\n");
sg.pass_thru("struct physx_PxConvexMesh_Pod;\n");
sg.pass_thru("struct physx_PxTriangleMesh_Pod;\n");
sg.pass_thru("struct physx_PxBVH33TriangleMesh_Pod;\n");
sg.pass_thru("struct physx_PxBVH34TriangleMesh_Pod;\n");
sg.pass_thru("struct physx_PxTetrahedronMesh_Pod;\n");
sg.pass_thru("struct physx_PxHeightField_Pod;\n");
sg.pass_thru("struct physx_PxActor_Pod;\n");
sg.pass_thru("struct physx_PxRigidActor_Pod;\n");
sg.pass_thru("struct physx_PxRigidBody_Pod;\n");
sg.pass_thru("struct physx_PxRigidDynamic_Pod;\n");
sg.pass_thru("struct physx_PxRigidStatic_Pod;\n");
sg.pass_thru("struct physx_PxArticulationLink_Pod;\n");
sg.pass_thru("struct physx_PxArticulationJointReducedCoordinate_Pod;\n");
sg.pass_thru("struct physx_PxArticulationReducedCoordinate_Pod;\n");
sg.pass_thru("struct physx_PxAggregate_Pod;\n");
sg.pass_thru("struct physx_PxConstraint_Pod;\n");
sg.pass_thru("struct physx_PxShape_Pod;\n");
sg.pass_thru("struct physx_PxPruningStructure_Pod;\n");
sg.pass_thru("struct physx_PxParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxPBDParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxFLIPParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxMPMParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxCustomParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxSoftBody_Pod;\n");
sg.pass_thru("struct physx_PxFEMCloth_Pod;\n");
sg.pass_thru("struct physx_PxHairSystem_Pod;\n");
sg.pass_thru("struct physx_PxParticleBuffer_Pod;\n");
sg.pass_thru("struct physx_PxParticleAndDiffuseBuffer_Pod;\n");
sg.pass_thru("struct physx_PxParticleClothBuffer_Pod;\n");
sg.pass_thru("struct physx_PxParticleRigidBuffer_Pod;\n");
struct physx_PxBase_Pod: public physx::PxBase {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxBase_Pod", "PxBase");
sg.end_struct(sizeof(physx::PxBase));
}
};
physx_PxBase_Pod::dump_layout(sg);
struct physx_PxRefCounted_Pod: public physx::PxRefCounted {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxRefCounted_Pod", "PxRefCounted");
sg.end_struct(sizeof(physx::PxRefCounted));
}
};
physx_PxRefCounted_Pod::dump_layout(sg);
struct physx_PxSpringModifiers_Pod: public physx::PxSpringModifiers {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxSpringModifiers_Pod", "PxSpringModifiers");
sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxSpringModifiers_Pod, stiffness));
sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxSpringModifiers_Pod, damping));
sg.end_struct(sizeof(physx::PxSpringModifiers));
}
};
physx_PxSpringModifiers_Pod::dump_layout(sg);
struct physx_PxRestitutionModifiers_Pod: public physx::PxRestitutionModifiers {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxRestitutionModifiers_Pod", "PxRestitutionModifiers");
sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxRestitutionModifiers_Pod, restitution));
sg.add_field("float velocityThreshold", "velocityThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxRestitutionModifiers_Pod, velocityThreshold));
sg.end_struct(sizeof(physx::PxRestitutionModifiers));
}
};
physx_PxRestitutionModifiers_Pod::dump_layout(sg);
sg.pass_thru("union physx_Px1DConstraintMods_Pod {\n physx_PxSpringModifiers_Pod spring;\n physx_PxRestitutionModifiers_Pod bounce;\n};\n");
struct physx_Px1DConstraint_Pod: public physx::Px1DConstraint {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_Px1DConstraint_Pod", "Px1DConstraint");
sg.add_field("physx_PxVec3_Pod linear0", "linear0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_Px1DConstraint_Pod, linear0));
sg.add_field("float geometricError", "geometricError", "f32", sizeof(float), unsafe_offsetof(physx_Px1DConstraint_Pod, geometricError));
sg.add_field("physx_PxVec3_Pod angular0", "angular0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_Px1DConstraint_Pod, angular0));
sg.add_field("float velocityTarget", "velocityTarget", "f32", sizeof(float), unsafe_offsetof(physx_Px1DConstraint_Pod, velocityTarget));
sg.add_field("physx_PxVec3_Pod linear1", "linear1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_Px1DConstraint_Pod, linear1));
sg.add_field("float minImpulse", "minImpulse", "f32", sizeof(float), unsafe_offsetof(physx_Px1DConstraint_Pod, minImpulse));
sg.add_field("physx_PxVec3_Pod angular1", "angular1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_Px1DConstraint_Pod, angular1));
sg.add_field("float maxImpulse", "maxImpulse", "f32", sizeof(float), unsafe_offsetof(physx_Px1DConstraint_Pod, maxImpulse));
sg.add_field("physx_Px1DConstraintMods_Pod mods", "mods", "Px1DConstraintMods", sizeof(physx::Px1DConstraintMods), unsafe_offsetof(physx_Px1DConstraint_Pod, mods));
sg.add_field("float forInternalUse", "forInternalUse", "f32", sizeof(float), unsafe_offsetof(physx_Px1DConstraint_Pod, forInternalUse));
sg.add_field("uint16_t flags", "flags", "u16", sizeof(uint16_t), unsafe_offsetof(physx_Px1DConstraint_Pod, flags));
sg.add_field("uint16_t solveHint", "solveHint", "u16", sizeof(uint16_t), unsafe_offsetof(physx_Px1DConstraint_Pod, solveHint));
sg.end_struct(sizeof(physx::Px1DConstraint));
}
};
physx_Px1DConstraint_Pod::dump_layout(sg);
struct physx_PxConstraintInvMassScale_Pod: public physx::PxConstraintInvMassScale {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxConstraintInvMassScale_Pod", "PxConstraintInvMassScale");
sg.add_field("float linear0", "linear0", "f32", sizeof(float), unsafe_offsetof(physx_PxConstraintInvMassScale_Pod, linear0));
sg.add_field("float angular0", "angular0", "f32", sizeof(float), unsafe_offsetof(physx_PxConstraintInvMassScale_Pod, angular0));
sg.add_field("float linear1", "linear1", "f32", sizeof(float), unsafe_offsetof(physx_PxConstraintInvMassScale_Pod, linear1));
sg.add_field("float angular1", "angular1", "f32", sizeof(float), unsafe_offsetof(physx_PxConstraintInvMassScale_Pod, angular1));
sg.end_struct(sizeof(physx::PxConstraintInvMassScale));
}
};
physx_PxConstraintInvMassScale_Pod::dump_layout(sg);
sg.pass_thru("struct physx_PxConstraintVisualizer_Pod {\n void* vtable_;\n};\n");
sg.pass_thru("struct physx_PxConstraintConnector_Pod {\n void* vtable_;\n};\n");
struct physx_PxContactPoint_Pod: public physx::PxContactPoint {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxContactPoint_Pod", "PxContactPoint");
sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPoint_Pod, normal));
sg.add_field("float separation", "separation", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPoint_Pod, separation));
sg.add_field("physx_PxVec3_Pod point", "point", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPoint_Pod, point));
sg.add_field("float maxImpulse", "maxImpulse", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPoint_Pod, maxImpulse));
sg.add_field("physx_PxVec3_Pod targetVel", "targetVel", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPoint_Pod, targetVel));
sg.add_field("float staticFriction", "staticFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPoint_Pod, staticFriction));
sg.add_field("uint8_t materialFlags", "materialFlags", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPoint_Pod, materialFlags));
sg.add_field("uint32_t internalFaceIndex1", "internalFaceIndex1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPoint_Pod, internalFaceIndex1));
sg.add_field("float dynamicFriction", "dynamicFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPoint_Pod, dynamicFriction));
sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPoint_Pod, restitution));
sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPoint_Pod, damping));
sg.end_struct(sizeof(physx::PxContactPoint));
}
};
physx_PxContactPoint_Pod::dump_layout(sg);
sg.pass_thru("struct physx_PxTGSSolverBodyVel_Pod;\n");
struct physx_PxSolverBody_Pod: public physx::PxSolverBody {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxSolverBody_Pod", "PxSolverBody");
sg.add_field("physx_PxVec3_Pod linearVelocity", "linearVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSolverBody_Pod, linearVelocity));
sg.add_field("uint16_t maxSolverNormalProgress", "maxSolverNormalProgress", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxSolverBody_Pod, maxSolverNormalProgress));
sg.add_field("uint16_t maxSolverFrictionProgress", "maxSolverFrictionProgress", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxSolverBody_Pod, maxSolverFrictionProgress));
sg.add_field("physx_PxVec3_Pod angularState", "angularState", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSolverBody_Pod, angularState));
sg.add_field("uint32_t solverProgress", "solverProgress", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverBody_Pod, solverProgress));
sg.end_struct(sizeof(physx::PxSolverBody));
}
};
physx_PxSolverBody_Pod::dump_layout(sg);
struct physx_PxSolverBodyData_Pod: public physx::PxSolverBodyData {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxSolverBodyData_Pod", "PxSolverBodyData");
sg.add_field("physx_PxVec3_Pod linearVelocity", "linearVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSolverBodyData_Pod, linearVelocity));
sg.add_field("float invMass", "invMass", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverBodyData_Pod, invMass));
sg.add_field("physx_PxVec3_Pod angularVelocity", "angularVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSolverBodyData_Pod, angularVelocity));
sg.add_field("float reportThreshold", "reportThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverBodyData_Pod, reportThreshold));
sg.add_field("physx_PxMat33_Pod sqrtInvInertia", "sqrtInvInertia", "PxMat33", sizeof(physx::PxMat33), unsafe_offsetof(physx_PxSolverBodyData_Pod, sqrtInvInertia));
sg.add_field("float penBiasClamp", "penBiasClamp", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverBodyData_Pod, penBiasClamp));
sg.add_field("uint32_t nodeIndex", "nodeIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverBodyData_Pod, nodeIndex));
sg.add_field("float maxContactImpulse", "maxContactImpulse", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverBodyData_Pod, maxContactImpulse));
sg.add_field("physx_PxTransform_Pod body2World", "body2World", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxSolverBodyData_Pod, body2World));
sg.add_field("uint16_t pad", "pad", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxSolverBodyData_Pod, pad));
sg.end_struct(sizeof(physx::PxSolverBodyData));
}
};
physx_PxSolverBodyData_Pod::dump_layout(sg);
struct physx_PxConstraintBatchHeader_Pod: public physx::PxConstraintBatchHeader {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxConstraintBatchHeader_Pod", "PxConstraintBatchHeader");
sg.add_field("uint32_t startIndex", "startIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxConstraintBatchHeader_Pod, startIndex));
sg.add_field("uint16_t stride", "stride", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxConstraintBatchHeader_Pod, stride));
sg.add_field("uint16_t constraintType", "constraintType", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxConstraintBatchHeader_Pod, constraintType));
sg.end_struct(sizeof(physx::PxConstraintBatchHeader));
}
};
physx_PxConstraintBatchHeader_Pod::dump_layout(sg);
struct physx_PxSolverConstraintDesc_Pod: public physx::PxSolverConstraintDesc {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxSolverConstraintDesc_Pod", "PxSolverConstraintDesc");
sg.add_field("uint32_t bodyADataIndex", "bodyADataIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, bodyADataIndex));
sg.add_field("uint32_t bodyBDataIndex", "bodyBDataIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, bodyBDataIndex));
sg.add_field("uint32_t linkIndexA", "linkIndexA", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, linkIndexA));
sg.add_field("uint32_t linkIndexB", "linkIndexB", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, linkIndexB));
sg.add_field("uint8_t* constraint", "constraint", "*mut u8", sizeof(uint8_t*), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, constraint));
sg.add_field("void* writeBack", "writeBack", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, writeBack));
sg.add_field("uint16_t progressA", "progressA", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, progressA));
sg.add_field("uint16_t progressB", "progressB", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, progressB));
sg.add_field("uint16_t constraintLengthOver16", "constraintLengthOver16", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, constraintLengthOver16));
sg.add_field("uint8_t padding[10]", "padding", "[u8; 10]", sizeof(uint8_t[10]), unsafe_offsetof(physx_PxSolverConstraintDesc_Pod, padding));
sg.end_struct(sizeof(physx::PxSolverConstraintDesc));
}
};
physx_PxSolverConstraintDesc_Pod::dump_layout(sg);
struct physx_PxSolverConstraintPrepDescBase_Pod: public physx::PxSolverConstraintPrepDescBase {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxSolverConstraintPrepDescBase_Pod", "PxSolverConstraintPrepDescBase");
sg.add_field("physx_PxConstraintInvMassScale_Pod invMassScales", "invMassScales", "PxConstraintInvMassScale", sizeof(physx::PxConstraintInvMassScale), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, invMassScales));
sg.add_field("physx_PxSolverConstraintDesc_Pod* desc", "desc", "*mut PxSolverConstraintDesc", sizeof(physx::PxSolverConstraintDesc*), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, desc));
sg.add_field("physx_PxSolverBody_Pod const* body0", "body0", "*const PxSolverBody", sizeof(physx::PxSolverBody const*), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, body0));
sg.add_field("physx_PxSolverBody_Pod const* body1", "body1", "*const PxSolverBody", sizeof(physx::PxSolverBody const*), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, body1));
sg.add_field("physx_PxSolverBodyData_Pod const* data0", "data0", "*const PxSolverBodyData", sizeof(physx::PxSolverBodyData const*), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, data0));
sg.add_field("physx_PxSolverBodyData_Pod const* data1", "data1", "*const PxSolverBodyData", sizeof(physx::PxSolverBodyData const*), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, data1));
sg.add_field("physx_PxTransform_Pod bodyFrame0", "bodyFrame0", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, bodyFrame0));
sg.add_field("physx_PxTransform_Pod bodyFrame1", "bodyFrame1", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, bodyFrame1));
sg.add_field("int32_t bodyState0", "bodyState0", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, bodyState0));
sg.add_field("int32_t bodyState1", "bodyState1", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxSolverConstraintPrepDescBase_Pod, bodyState1));
sg.end_struct(sizeof(physx::PxSolverConstraintPrepDescBase));
}
};
physx_PxSolverConstraintPrepDescBase_Pod::dump_layout(sg);
struct physx_PxSolverConstraintPrepDesc_Pod: public physx::PxSolverConstraintPrepDesc {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxSolverConstraintPrepDesc_Pod", "PxSolverConstraintPrepDesc");
sg.add_field("physx_PxConstraintInvMassScale_Pod invMassScales", "invMassScales", "PxConstraintInvMassScale", sizeof(physx::PxConstraintInvMassScale), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, invMassScales));
sg.add_field("physx_PxSolverConstraintDesc_Pod* desc", "desc", "*mut PxSolverConstraintDesc", sizeof(physx::PxSolverConstraintDesc*), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, desc));
sg.add_field("physx_PxSolverBody_Pod const* body0", "body0", "*const PxSolverBody", sizeof(physx::PxSolverBody const*), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, body0));
sg.add_field("physx_PxSolverBody_Pod const* body1", "body1", "*const PxSolverBody", sizeof(physx::PxSolverBody const*), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, body1));
sg.add_field("physx_PxSolverBodyData_Pod const* data0", "data0", "*const PxSolverBodyData", sizeof(physx::PxSolverBodyData const*), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, data0));
sg.add_field("physx_PxSolverBodyData_Pod const* data1", "data1", "*const PxSolverBodyData", sizeof(physx::PxSolverBodyData const*), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, data1));
sg.add_field("physx_PxTransform_Pod bodyFrame0", "bodyFrame0", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, bodyFrame0));
sg.add_field("physx_PxTransform_Pod bodyFrame1", "bodyFrame1", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, bodyFrame1));
sg.add_field("int32_t bodyState0", "bodyState0", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, bodyState0));
sg.add_field("int32_t bodyState1", "bodyState1", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, bodyState1));
sg.add_field("physx_Px1DConstraint_Pod* rows", "rows", "*mut Px1DConstraint", sizeof(physx::Px1DConstraint*), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, rows));
sg.add_field("uint32_t numRows", "numRows", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, numRows));
sg.add_field("float linBreakForce", "linBreakForce", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, linBreakForce));
sg.add_field("float angBreakForce", "angBreakForce", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, angBreakForce));
sg.add_field("float minResponseThreshold", "minResponseThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, minResponseThreshold));
sg.add_field("void* writeback", "writeback", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, writeback));
sg.add_field("bool disablePreprocessing", "disablePreprocessing", "bool", sizeof(bool), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, disablePreprocessing));
sg.add_field("bool improvedSlerp", "improvedSlerp", "bool", sizeof(bool), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, improvedSlerp));
sg.add_field("bool driveLimitsAreForces", "driveLimitsAreForces", "bool", sizeof(bool), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, driveLimitsAreForces));
sg.add_field("bool extendedLimits", "extendedLimits", "bool", sizeof(bool), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, extendedLimits));
sg.add_field("bool disableConstraint", "disableConstraint", "bool", sizeof(bool), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, disableConstraint));
sg.add_field("physx_PxVec3Padded_Pod body0WorldOffset", "body0WorldOffset", "PxVec3Padded", sizeof(physx::PxVec3Padded), unsafe_offsetof(physx_PxSolverConstraintPrepDesc_Pod, body0WorldOffset));
sg.end_struct(sizeof(physx::PxSolverConstraintPrepDesc));
}
};
physx_PxSolverConstraintPrepDesc_Pod::dump_layout(sg);
struct physx_PxSolverContactDesc_Pod: public physx::PxSolverContactDesc {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxSolverContactDesc_Pod", "PxSolverContactDesc");
sg.add_field("physx_PxConstraintInvMassScale_Pod invMassScales", "invMassScales", "PxConstraintInvMassScale", sizeof(physx::PxConstraintInvMassScale), unsafe_offsetof(physx_PxSolverContactDesc_Pod, invMassScales));
sg.add_field("physx_PxSolverConstraintDesc_Pod* desc", "desc", "*mut PxSolverConstraintDesc", sizeof(physx::PxSolverConstraintDesc*), unsafe_offsetof(physx_PxSolverContactDesc_Pod, desc));
sg.add_field("physx_PxSolverBody_Pod const* body0", "body0", "*const PxSolverBody", sizeof(physx::PxSolverBody const*), unsafe_offsetof(physx_PxSolverContactDesc_Pod, body0));
sg.add_field("physx_PxSolverBody_Pod const* body1", "body1", "*const PxSolverBody", sizeof(physx::PxSolverBody const*), unsafe_offsetof(physx_PxSolverContactDesc_Pod, body1));
sg.add_field("physx_PxSolverBodyData_Pod const* data0", "data0", "*const PxSolverBodyData", sizeof(physx::PxSolverBodyData const*), unsafe_offsetof(physx_PxSolverContactDesc_Pod, data0));
sg.add_field("physx_PxSolverBodyData_Pod const* data1", "data1", "*const PxSolverBodyData", sizeof(physx::PxSolverBodyData const*), unsafe_offsetof(physx_PxSolverContactDesc_Pod, data1));
sg.add_field("physx_PxTransform_Pod bodyFrame0", "bodyFrame0", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxSolverContactDesc_Pod, bodyFrame0));
sg.add_field("physx_PxTransform_Pod bodyFrame1", "bodyFrame1", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxSolverContactDesc_Pod, bodyFrame1));
sg.add_field("int32_t bodyState0", "bodyState0", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxSolverContactDesc_Pod, bodyState0));
sg.add_field("int32_t bodyState1", "bodyState1", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxSolverContactDesc_Pod, bodyState1));
sg.add_field("void* shapeInteraction", "shapeInteraction", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxSolverContactDesc_Pod, shapeInteraction));
sg.add_field("physx_PxContactPoint_Pod* contacts", "contacts", "*mut PxContactPoint", sizeof(physx::PxContactPoint*), unsafe_offsetof(physx_PxSolverContactDesc_Pod, contacts));
sg.add_field("uint32_t numContacts", "numContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverContactDesc_Pod, numContacts));
sg.add_field("bool hasMaxImpulse", "hasMaxImpulse", "bool", sizeof(bool), unsafe_offsetof(physx_PxSolverContactDesc_Pod, hasMaxImpulse));
sg.add_field("bool disableStrongFriction", "disableStrongFriction", "bool", sizeof(bool), unsafe_offsetof(physx_PxSolverContactDesc_Pod, disableStrongFriction));
sg.add_field("bool hasForceThresholds", "hasForceThresholds", "bool", sizeof(bool), unsafe_offsetof(physx_PxSolverContactDesc_Pod, hasForceThresholds));
sg.add_field("float restDistance", "restDistance", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverContactDesc_Pod, restDistance));
sg.add_field("float maxCCDSeparation", "maxCCDSeparation", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverContactDesc_Pod, maxCCDSeparation));
sg.add_field("uint8_t* frictionPtr", "frictionPtr", "*mut u8", sizeof(uint8_t*), unsafe_offsetof(physx_PxSolverContactDesc_Pod, frictionPtr));
sg.add_field("uint8_t frictionCount", "frictionCount", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxSolverContactDesc_Pod, frictionCount));
sg.add_field("float* contactForces", "contactForces", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxSolverContactDesc_Pod, contactForces));
sg.add_field("uint32_t startFrictionPatchIndex", "startFrictionPatchIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverContactDesc_Pod, startFrictionPatchIndex));
sg.add_field("uint32_t numFrictionPatches", "numFrictionPatches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverContactDesc_Pod, numFrictionPatches));
sg.add_field("uint32_t startContactPatchIndex", "startContactPatchIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSolverContactDesc_Pod, startContactPatchIndex));
sg.add_field("uint16_t numContactPatches", "numContactPatches", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxSolverContactDesc_Pod, numContactPatches));
sg.add_field("uint16_t axisConstraintCount", "axisConstraintCount", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxSolverContactDesc_Pod, axisConstraintCount));
sg.add_field("float offsetSlop", "offsetSlop", "f32", sizeof(float), unsafe_offsetof(physx_PxSolverContactDesc_Pod, offsetSlop));
sg.end_struct(sizeof(physx::PxSolverContactDesc));
}
};
physx_PxSolverContactDesc_Pod::dump_layout(sg);
sg.pass_thru("struct physx_PxConstraintAllocator_Pod {\n void* vtable_;\n};\n");
struct physx_PxArticulationLimit_Pod: public physx::PxArticulationLimit {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxArticulationLimit_Pod", "PxArticulationLimit");
sg.add_field("float low", "low", "f32", sizeof(float), unsafe_offsetof(physx_PxArticulationLimit_Pod, low));
sg.add_field("float high", "high", "f32", sizeof(float), unsafe_offsetof(physx_PxArticulationLimit_Pod, high));
sg.end_struct(sizeof(physx::PxArticulationLimit));
}
};
physx_PxArticulationLimit_Pod::dump_layout(sg);
struct physx_PxArticulationDrive_Pod: public physx::PxArticulationDrive {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxArticulationDrive_Pod", "PxArticulationDrive");
sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxArticulationDrive_Pod, stiffness));
sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxArticulationDrive_Pod, damping));
sg.add_field("float maxForce", "maxForce", "f32", sizeof(float), unsafe_offsetof(physx_PxArticulationDrive_Pod, maxForce));
sg.add_field("int32_t driveType", "driveType", "PxArticulationDriveType", sizeof(physx::PxArticulationDriveType::Enum), unsafe_offsetof(physx_PxArticulationDrive_Pod, driveType));
sg.end_struct(sizeof(physx::PxArticulationDrive));
}
};
physx_PxArticulationDrive_Pod::dump_layout(sg);
struct physx_PxTGSSolverBodyVel_Pod: public physx::PxTGSSolverBodyVel {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTGSSolverBodyVel_Pod", "PxTGSSolverBodyVel");
sg.add_field("physx_PxVec3_Pod linearVelocity", "linearVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, linearVelocity));
sg.add_field("uint16_t nbStaticInteractions", "nbStaticInteractions", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, nbStaticInteractions));
sg.add_field("uint16_t maxDynamicPartition", "maxDynamicPartition", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, maxDynamicPartition));
sg.add_field("physx_PxVec3_Pod angularVelocity", "angularVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, angularVelocity));
sg.add_field("uint32_t partitionMask", "partitionMask", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, partitionMask));
sg.add_field("physx_PxVec3_Pod deltaAngDt", "deltaAngDt", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, deltaAngDt));
sg.add_field("float maxAngVel", "maxAngVel", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, maxAngVel));
sg.add_field("physx_PxVec3_Pod deltaLinDt", "deltaLinDt", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, deltaLinDt));
sg.add_field("uint16_t lockFlags", "lockFlags", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, lockFlags));
sg.add_field("bool isKinematic", "isKinematic", "bool", sizeof(bool), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, isKinematic));
sg.add_field("uint8_t pad", "pad", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxTGSSolverBodyVel_Pod, pad));
sg.end_struct(sizeof(physx::PxTGSSolverBodyVel));
}
};
physx_PxTGSSolverBodyVel_Pod::dump_layout(sg);
struct physx_PxTGSSolverBodyTxInertia_Pod: public physx::PxTGSSolverBodyTxInertia {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTGSSolverBodyTxInertia_Pod", "PxTGSSolverBodyTxInertia");
sg.add_field("physx_PxTransform_Pod deltaBody2World", "deltaBody2World", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxTGSSolverBodyTxInertia_Pod, deltaBody2World));
sg.add_field("physx_PxMat33_Pod sqrtInvInertia", "sqrtInvInertia", "PxMat33", sizeof(physx::PxMat33), unsafe_offsetof(physx_PxTGSSolverBodyTxInertia_Pod, sqrtInvInertia));
sg.end_struct(sizeof(physx::PxTGSSolverBodyTxInertia));
}
};
physx_PxTGSSolverBodyTxInertia_Pod::dump_layout(sg);
struct physx_PxTGSSolverBodyData_Pod: public physx::PxTGSSolverBodyData {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTGSSolverBodyData_Pod", "PxTGSSolverBodyData");
sg.add_field("physx_PxVec3_Pod originalLinearVelocity", "originalLinearVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxTGSSolverBodyData_Pod, originalLinearVelocity));
sg.add_field("float maxContactImpulse", "maxContactImpulse", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverBodyData_Pod, maxContactImpulse));
sg.add_field("physx_PxVec3_Pod originalAngularVelocity", "originalAngularVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxTGSSolverBodyData_Pod, originalAngularVelocity));
sg.add_field("float penBiasClamp", "penBiasClamp", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverBodyData_Pod, penBiasClamp));
sg.add_field("float invMass", "invMass", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverBodyData_Pod, invMass));
sg.add_field("uint32_t nodeIndex", "nodeIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTGSSolverBodyData_Pod, nodeIndex));
sg.add_field("float reportThreshold", "reportThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverBodyData_Pod, reportThreshold));
sg.add_field("uint32_t pad", "pad", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTGSSolverBodyData_Pod, pad));
sg.end_struct(sizeof(physx::PxTGSSolverBodyData));
}
};
physx_PxTGSSolverBodyData_Pod::dump_layout(sg);
struct physx_PxTGSSolverConstraintPrepDescBase_Pod: public physx::PxTGSSolverConstraintPrepDescBase {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTGSSolverConstraintPrepDescBase_Pod", "PxTGSSolverConstraintPrepDescBase");
sg.add_field("physx_PxConstraintInvMassScale_Pod invMassScales", "invMassScales", "PxConstraintInvMassScale", sizeof(physx::PxConstraintInvMassScale), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, invMassScales));
sg.add_field("physx_PxSolverConstraintDesc_Pod* desc", "desc", "*mut PxSolverConstraintDesc", sizeof(physx::PxSolverConstraintDesc*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, desc));
sg.add_field("physx_PxTGSSolverBodyVel_Pod const* body0", "body0", "*const PxTGSSolverBodyVel", sizeof(physx::PxTGSSolverBodyVel const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, body0));
sg.add_field("physx_PxTGSSolverBodyVel_Pod const* body1", "body1", "*const PxTGSSolverBodyVel", sizeof(physx::PxTGSSolverBodyVel const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, body1));
sg.add_field("physx_PxTGSSolverBodyTxInertia_Pod const* body0TxI", "body0TxI", "*const PxTGSSolverBodyTxInertia", sizeof(physx::PxTGSSolverBodyTxInertia const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, body0TxI));
sg.add_field("physx_PxTGSSolverBodyTxInertia_Pod const* body1TxI", "body1TxI", "*const PxTGSSolverBodyTxInertia", sizeof(physx::PxTGSSolverBodyTxInertia const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, body1TxI));
sg.add_field("physx_PxTGSSolverBodyData_Pod const* bodyData0", "bodyData0", "*const PxTGSSolverBodyData", sizeof(physx::PxTGSSolverBodyData const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, bodyData0));
sg.add_field("physx_PxTGSSolverBodyData_Pod const* bodyData1", "bodyData1", "*const PxTGSSolverBodyData", sizeof(physx::PxTGSSolverBodyData const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, bodyData1));
sg.add_field("physx_PxTransform_Pod bodyFrame0", "bodyFrame0", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, bodyFrame0));
sg.add_field("physx_PxTransform_Pod bodyFrame1", "bodyFrame1", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, bodyFrame1));
sg.add_field("int32_t bodyState0", "bodyState0", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, bodyState0));
sg.add_field("int32_t bodyState1", "bodyState1", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDescBase_Pod, bodyState1));
sg.end_struct(sizeof(physx::PxTGSSolverConstraintPrepDescBase));
}
};
physx_PxTGSSolverConstraintPrepDescBase_Pod::dump_layout(sg);
struct physx_PxTGSSolverConstraintPrepDesc_Pod: public physx::PxTGSSolverConstraintPrepDesc {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTGSSolverConstraintPrepDesc_Pod", "PxTGSSolverConstraintPrepDesc");
sg.add_field("physx_PxConstraintInvMassScale_Pod invMassScales", "invMassScales", "PxConstraintInvMassScale", sizeof(physx::PxConstraintInvMassScale), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, invMassScales));
sg.add_field("physx_PxSolverConstraintDesc_Pod* desc", "desc", "*mut PxSolverConstraintDesc", sizeof(physx::PxSolverConstraintDesc*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, desc));
sg.add_field("physx_PxTGSSolverBodyVel_Pod const* body0", "body0", "*const PxTGSSolverBodyVel", sizeof(physx::PxTGSSolverBodyVel const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, body0));
sg.add_field("physx_PxTGSSolverBodyVel_Pod const* body1", "body1", "*const PxTGSSolverBodyVel", sizeof(physx::PxTGSSolverBodyVel const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, body1));
sg.add_field("physx_PxTGSSolverBodyTxInertia_Pod const* body0TxI", "body0TxI", "*const PxTGSSolverBodyTxInertia", sizeof(physx::PxTGSSolverBodyTxInertia const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, body0TxI));
sg.add_field("physx_PxTGSSolverBodyTxInertia_Pod const* body1TxI", "body1TxI", "*const PxTGSSolverBodyTxInertia", sizeof(physx::PxTGSSolverBodyTxInertia const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, body1TxI));
sg.add_field("physx_PxTGSSolverBodyData_Pod const* bodyData0", "bodyData0", "*const PxTGSSolverBodyData", sizeof(physx::PxTGSSolverBodyData const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, bodyData0));
sg.add_field("physx_PxTGSSolverBodyData_Pod const* bodyData1", "bodyData1", "*const PxTGSSolverBodyData", sizeof(physx::PxTGSSolverBodyData const*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, bodyData1));
sg.add_field("physx_PxTransform_Pod bodyFrame0", "bodyFrame0", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, bodyFrame0));
sg.add_field("physx_PxTransform_Pod bodyFrame1", "bodyFrame1", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, bodyFrame1));
sg.add_field("int32_t bodyState0", "bodyState0", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, bodyState0));
sg.add_field("int32_t bodyState1", "bodyState1", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, bodyState1));
sg.add_field("physx_Px1DConstraint_Pod* rows", "rows", "*mut Px1DConstraint", sizeof(physx::Px1DConstraint*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, rows));
sg.add_field("uint32_t numRows", "numRows", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, numRows));
sg.add_field("float linBreakForce", "linBreakForce", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, linBreakForce));
sg.add_field("float angBreakForce", "angBreakForce", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, angBreakForce));
sg.add_field("float minResponseThreshold", "minResponseThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, minResponseThreshold));
sg.add_field("void* writeback", "writeback", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, writeback));
sg.add_field("bool disablePreprocessing", "disablePreprocessing", "bool", sizeof(bool), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, disablePreprocessing));
sg.add_field("bool improvedSlerp", "improvedSlerp", "bool", sizeof(bool), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, improvedSlerp));
sg.add_field("bool driveLimitsAreForces", "driveLimitsAreForces", "bool", sizeof(bool), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, driveLimitsAreForces));
sg.add_field("bool extendedLimits", "extendedLimits", "bool", sizeof(bool), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, extendedLimits));
sg.add_field("bool disableConstraint", "disableConstraint", "bool", sizeof(bool), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, disableConstraint));
sg.add_field("physx_PxVec3Padded_Pod body0WorldOffset", "body0WorldOffset", "PxVec3Padded", sizeof(physx::PxVec3Padded), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, body0WorldOffset));
sg.add_field("physx_PxVec3Padded_Pod cA2w", "cA2w", "PxVec3Padded", sizeof(physx::PxVec3Padded), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, cA2w));
sg.add_field("physx_PxVec3Padded_Pod cB2w", "cB2w", "PxVec3Padded", sizeof(physx::PxVec3Padded), unsafe_offsetof(physx_PxTGSSolverConstraintPrepDesc_Pod, cB2w));
sg.end_struct(sizeof(physx::PxTGSSolverConstraintPrepDesc));
}
};
physx_PxTGSSolverConstraintPrepDesc_Pod::dump_layout(sg);
struct physx_PxTGSSolverContactDesc_Pod: public physx::PxTGSSolverContactDesc {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTGSSolverContactDesc_Pod", "PxTGSSolverContactDesc");
sg.add_field("physx_PxConstraintInvMassScale_Pod invMassScales", "invMassScales", "PxConstraintInvMassScale", sizeof(physx::PxConstraintInvMassScale), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, invMassScales));
sg.add_field("physx_PxSolverConstraintDesc_Pod* desc", "desc", "*mut PxSolverConstraintDesc", sizeof(physx::PxSolverConstraintDesc*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, desc));
sg.add_field("physx_PxTGSSolverBodyVel_Pod const* body0", "body0", "*const PxTGSSolverBodyVel", sizeof(physx::PxTGSSolverBodyVel const*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, body0));
sg.add_field("physx_PxTGSSolverBodyVel_Pod const* body1", "body1", "*const PxTGSSolverBodyVel", sizeof(physx::PxTGSSolverBodyVel const*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, body1));
sg.add_field("physx_PxTGSSolverBodyTxInertia_Pod const* body0TxI", "body0TxI", "*const PxTGSSolverBodyTxInertia", sizeof(physx::PxTGSSolverBodyTxInertia const*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, body0TxI));
sg.add_field("physx_PxTGSSolverBodyTxInertia_Pod const* body1TxI", "body1TxI", "*const PxTGSSolverBodyTxInertia", sizeof(physx::PxTGSSolverBodyTxInertia const*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, body1TxI));
sg.add_field("physx_PxTGSSolverBodyData_Pod const* bodyData0", "bodyData0", "*const PxTGSSolverBodyData", sizeof(physx::PxTGSSolverBodyData const*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, bodyData0));
sg.add_field("physx_PxTGSSolverBodyData_Pod const* bodyData1", "bodyData1", "*const PxTGSSolverBodyData", sizeof(physx::PxTGSSolverBodyData const*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, bodyData1));
sg.add_field("physx_PxTransform_Pod bodyFrame0", "bodyFrame0", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, bodyFrame0));
sg.add_field("physx_PxTransform_Pod bodyFrame1", "bodyFrame1", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, bodyFrame1));
sg.add_field("int32_t bodyState0", "bodyState0", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, bodyState0));
sg.add_field("int32_t bodyState1", "bodyState1", "BodyState", sizeof(physx::PxSolverConstraintPrepDescBase::BodyState), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, bodyState1));
sg.add_field("void* shapeInteraction", "shapeInteraction", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, shapeInteraction));
sg.add_field("physx_PxContactPoint_Pod* contacts", "contacts", "*mut PxContactPoint", sizeof(physx::PxContactPoint*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, contacts));
sg.add_field("uint32_t numContacts", "numContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, numContacts));
sg.add_field("bool hasMaxImpulse", "hasMaxImpulse", "bool", sizeof(bool), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, hasMaxImpulse));
sg.add_field("bool disableStrongFriction", "disableStrongFriction", "bool", sizeof(bool), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, disableStrongFriction));
sg.add_field("bool hasForceThresholds", "hasForceThresholds", "bool", sizeof(bool), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, hasForceThresholds));
sg.add_field("float restDistance", "restDistance", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, restDistance));
sg.add_field("float maxCCDSeparation", "maxCCDSeparation", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, maxCCDSeparation));
sg.add_field("uint8_t* frictionPtr", "frictionPtr", "*mut u8", sizeof(uint8_t*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, frictionPtr));
sg.add_field("uint8_t frictionCount", "frictionCount", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, frictionCount));
sg.add_field("float* contactForces", "contactForces", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, contactForces));
sg.add_field("uint32_t startFrictionPatchIndex", "startFrictionPatchIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, startFrictionPatchIndex));
sg.add_field("uint32_t numFrictionPatches", "numFrictionPatches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, numFrictionPatches));
sg.add_field("uint32_t startContactPatchIndex", "startContactPatchIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, startContactPatchIndex));
sg.add_field("uint16_t numContactPatches", "numContactPatches", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, numContactPatches));
sg.add_field("uint16_t axisConstraintCount", "axisConstraintCount", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, axisConstraintCount));
sg.add_field("float maxImpulse", "maxImpulse", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, maxImpulse));
sg.add_field("float torsionalPatchRadius", "torsionalPatchRadius", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, torsionalPatchRadius));
sg.add_field("float minTorsionalPatchRadius", "minTorsionalPatchRadius", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, minTorsionalPatchRadius));
sg.add_field("float offsetSlop", "offsetSlop", "f32", sizeof(float), unsafe_offsetof(physx_PxTGSSolverContactDesc_Pod, offsetSlop));
sg.end_struct(sizeof(physx::PxTGSSolverContactDesc));
}
};
physx_PxTGSSolverContactDesc_Pod::dump_layout(sg);
sg.finish();
}

View File

@@ -0,0 +1,10 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.size_asserts
---
using namespace physx;
#include "structgen_out.hpp"
static_assert(sizeof(physx::PxAllocatorCallback) == sizeof(physx_PxAllocatorCallback_Pod), "POD wrapper for `physx::PxAllocatorCallback` has incorrect size");

View File

@@ -0,0 +1,18 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.rust_decls
---
#[derive(Clone, Copy)]
#[cfg_attr(feature = "debug-structs", derive(Debug))]
#[repr(C)]
pub struct PxAllocatorCallback {
vtable_: *const std::ffi::c_void,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct MemoryBuffer {
_unused: [u8; 0],
}

View File

@@ -0,0 +1,20 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.structgen
---
// Automatically generated by pxbind
#include "PxPhysicsAPI.h"
using namespace physx;
#define unsafe_offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
#include "structgen.hpp"
int main() {
PodStructGen sg;
sg.pass_thru("struct physx_PxAllocatorCallback_Pod;\n");
sg.pass_thru("struct physx_PxAllocatorCallback_Pod {\n void* vtable_;\n};\n");
sg.pass_thru("struct physx_MemoryBuffer_Pod;\n");
sg.finish();
}

View File

@@ -0,0 +1,10 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.size_asserts
---
using namespace physx;
#include "structgen_out.hpp"
static_assert(sizeof(physx::PxReffyMcRefface) == sizeof(physx_PxReffyMcRefface_Pod), "POD wrapper for `physx::PxReffyMcRefface` has incorrect size");

View File

@@ -0,0 +1,6 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.rust_decls
---

View File

@@ -0,0 +1,27 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.structgen
---
// Automatically generated by pxbind
#include "PxPhysicsAPI.h"
using namespace physx;
#define unsafe_offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
#include "structgen.hpp"
int main() {
PodStructGen sg;
struct physx_PxReffyMcRefface_Pod: public physx::PxReffyMcRefface {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxReffyMcRefface_Pod", "PxReffyMcRefface");
sg.add_field("physx_PxVec3_Pod shapeSpaceCenterOfMass", "shapeSpaceCenterOfMass", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxReffyMcRefface_Pod, shapeSpaceCenterOfMass));
sg.add_field("bool isIdentityScale", "isIdentityScale", "bool", sizeof(bool), unsafe_offsetof(physx_PxReffyMcRefface_Pod, isIdentityScale));
sg.end_struct(sizeof(physx::PxReffyMcRefface));
}
};
physx_PxReffyMcRefface_Pod::dump_layout(sg);
sg.finish();
}

View File

@@ -0,0 +1,14 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.size_asserts
---
using namespace physx;
#include "structgen_out.hpp"
static_assert(sizeof(physx::PxVec3) == sizeof(physx_PxVec3_Pod), "POD wrapper for `physx::PxVec3` has incorrect size");
static_assert(sizeof(physx::PxVec3Padded) == sizeof(physx_PxVec3Padded_Pod), "POD wrapper for `physx::PxVec3Padded` has incorrect size");
static_assert(sizeof(physx::PxVec4) == sizeof(physx_PxVec4_Pod), "POD wrapper for `physx::PxVec4` has incorrect size");
static_assert(sizeof(physx::PxMat44) == sizeof(physx_PxMat44_Pod), "POD wrapper for `physx::PxMat44` has incorrect size");
static_assert(sizeof(physx::PxQuat) == sizeof(physx_PxQuat_Pod), "POD wrapper for `physx::PxQuat` has incorrect size");

View File

@@ -0,0 +1,10 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.rust_decls
---

View File

@@ -0,0 +1,76 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.structgen
---
// Automatically generated by pxbind
#include "PxPhysicsAPI.h"
using namespace physx;
#define unsafe_offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
#include "structgen.hpp"
int main() {
PodStructGen sg;
struct physx_PxVec3_Pod: public physx::PxVec3 {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxVec3_Pod", "PxVec3");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3_Pod, z));
sg.end_struct(sizeof(physx::PxVec3));
}
};
physx_PxVec3_Pod::dump_layout(sg);
struct physx_PxVec3Padded_Pod: public physx::PxVec3Padded {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxVec3Padded_Pod", "PxVec3Padded");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3Padded_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3Padded_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3Padded_Pod, z));
sg.add_field("uint32_t padding", "padding", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxVec3Padded_Pod, padding));
sg.end_struct(sizeof(physx::PxVec3Padded));
}
};
physx_PxVec3Padded_Pod::dump_layout(sg);
struct physx_PxVec4_Pod: public physx::PxVec4 {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxVec4_Pod", "PxVec4");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec4_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec4_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxVec4_Pod, z));
sg.add_field("float w", "w", "f32", sizeof(float), unsafe_offsetof(physx_PxVec4_Pod, w));
sg.end_struct(sizeof(physx::PxVec4));
}
};
physx_PxVec4_Pod::dump_layout(sg);
struct physx_PxMat44_Pod: public physx::PxMat44 {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxMat44_Pod", "PxMat44");
sg.add_field("physx_PxVec4_Pod column0", "column0", "glam::Vec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column0));
sg.add_field("physx_PxVec4_Pod column1", "column1", "glam::Vec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column1));
sg.add_field("physx_PxVec4_Pod column2", "column2", "glam::Vec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column2));
sg.add_field("physx_PxVec4_Pod column3", "column3", "glam::Vec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column3));
sg.end_struct(sizeof(physx::PxMat44));
}
};
physx_PxMat44_Pod::dump_layout(sg);
struct physx_PxQuat_Pod: public physx::PxQuat {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxQuat_Pod", "PxQuat");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, z));
sg.add_field("float w", "w", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, w));
sg.end_struct(sizeof(physx::PxQuat));
}
};
physx_PxQuat_Pod::dump_layout(sg);
sg.finish();
}

View File

@@ -0,0 +1,9 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.size_asserts
---
using namespace physx;
#include "structgen_out.hpp"

View File

@@ -0,0 +1,5 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.rust_decls
---

View File

@@ -0,0 +1,17 @@
---
source: physx-sys/pxbind/tests/records.rs
expression: ro.structgen
---
// Automatically generated by pxbind
#include "PxPhysicsAPI.h"
using namespace physx;
#define unsafe_offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
#include "structgen.hpp"
int main() {
PodStructGen sg;
sg.finish();
}

View File

@@ -0,0 +1,284 @@
---
source: physx-sys/pxbind/tests/structgen.rs
expression: generated.cpp
---
struct physx_PxAllocatorCallback_Pod;
struct physx_PxErrorCallback_Pod;
struct physx_PxAssertHandler_Pod;
struct physx_PxInputStream_Pod;
struct physx_PxInputData_Pod;
struct physx_PxOutputStream_Pod;
struct physx_PxVec2_Pod;
struct physx_PxVec3_Pod;
struct physx_PxVec4_Pod;
struct physx_PxQuat_Pod;
struct physx_PxMat33_Pod;
struct physx_PxMat34_Pod;
struct physx_PxMat44_Pod;
struct physx_PxTransform_Pod;
struct physx_PxPlane_Pod;
struct physx_PxBounds3_Pod;
struct physx_PxBase_Pod;
struct physx_PxSerializationContext_Pod;
struct physx_PxRepXSerializer_Pod;
struct physx_PxSerializer_Pod;
struct physx_PxPhysics_Pod;
struct physx_PxCollection_Pod;
struct physx_PxProcessPxBaseCallback_Pod {
void* vtable_;
};
struct physx_PxSerializationContext_Pod {
void* vtable_;
};
struct physx_PxDeserializationContext_Pod {
char structgen_pad0[16];
};
struct physx_PxSerializationRegistry_Pod {
void* vtable_;
};
struct physx_PxCollection_Pod {
void* vtable_;
};
struct physx_PxTypeInfo_Pod;
struct physx_PxMaterial_Pod;
struct physx_PxFEMSoftBodyMaterial_Pod;
struct physx_PxFEMClothMaterial_Pod;
struct physx_PxPBDMaterial_Pod;
struct physx_PxFLIPMaterial_Pod;
struct physx_PxMPMMaterial_Pod;
struct physx_PxCustomMaterial_Pod;
struct physx_PxConvexMesh_Pod;
struct physx_PxTriangleMesh_Pod;
struct physx_PxBVH33TriangleMesh_Pod;
struct physx_PxBVH34TriangleMesh_Pod;
struct physx_PxTetrahedronMesh_Pod;
struct physx_PxHeightField_Pod;
struct physx_PxActor_Pod;
struct physx_PxRigidActor_Pod;
struct physx_PxRigidBody_Pod;
struct physx_PxRigidDynamic_Pod;
struct physx_PxRigidStatic_Pod;
struct physx_PxArticulationLink_Pod;
struct physx_PxArticulationJointReducedCoordinate_Pod;
struct physx_PxArticulationReducedCoordinate_Pod;
struct physx_PxAggregate_Pod;
struct physx_PxConstraint_Pod;
struct physx_PxShape_Pod;
struct physx_PxPruningStructure_Pod;
struct physx_PxParticleSystem_Pod;
struct physx_PxPBDParticleSystem_Pod;
struct physx_PxFLIPParticleSystem_Pod;
struct physx_PxMPMParticleSystem_Pod;
struct physx_PxCustomParticleSystem_Pod;
struct physx_PxSoftBody_Pod;
struct physx_PxFEMCloth_Pod;
struct physx_PxHairSystem_Pod;
struct physx_PxParticleBuffer_Pod;
struct physx_PxParticleAndDiffuseBuffer_Pod;
struct physx_PxParticleClothBuffer_Pod;
struct physx_PxParticleRigidBuffer_Pod;
struct physx_PxAssertHandler_Pod {
void* vtable_;
};
struct physx_PxBase_Pod {
char structgen_pad0[16];
};
struct physx_PxRefCounted_Pod {
char structgen_pad0[16];
};
struct physx_PxGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
};
struct physx_PxVec3_Pod {
float x;
float y;
float z;
};
struct physx_PxVec3Padded_Pod {
float x;
float y;
float z;
uint32_t padding;
};
struct physx_PxQuat_Pod {
float x;
float y;
float z;
float w;
};
struct physx_PxTransform_Pod {
physx_PxQuat_Pod q;
physx_PxVec3_Pod p;
};
struct physx_PxTransformPadded_Pod {
physx_PxTransform_Pod transform;
uint32_t padding;
};
struct physx_PxPlane_Pod {
physx_PxVec3_Pod n;
float d;
};
struct physx_PxBoxGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
physx_PxVec3_Pod halfExtents;
};
struct physx_PxSphereGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
float radius;
};
struct physx_PxCapsuleGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
float radius;
float halfHeight;
};
struct physx_PxPlaneGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
};
struct physx_PxMat33_Pod {
physx_PxVec3_Pod column0;
physx_PxVec3_Pod column1;
physx_PxVec3_Pod column2;
};
struct physx_PxMeshScale_Pod {
physx_PxVec3_Pod scale;
physx_PxQuat_Pod rotation;
};
struct physx_PxStridedData_Pod {
uint32_t stride;
char structgen_pad0[4];
void const* data;
};
struct physx_PxBoundedData_Pod {
uint32_t stride;
char structgen_pad0[4];
void const* data;
uint32_t count;
char structgen_pad1[4];
};
struct physx_PxHullPolygon_Pod {
float mPlane[4];
uint16_t mNbVerts;
uint16_t mIndexBase;
};
struct physx_PxConvexMesh_Pod {
char structgen_pad0[16];
};
struct physx_PxConvexMeshGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
physx_PxMeshScale_Pod scale;
char structgen_pad1[4];
physx_PxConvexMesh_Pod* convexMesh;
uint8_t meshFlags;
char structgen_pad2[7];
};
struct physx_PxTriangleMeshGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
physx_PxMeshScale_Pod scale;
uint8_t meshFlags;
char structgen_pad1[3];
physx_PxTriangleMesh_Pod* triangleMesh;
};
struct physx_PxHeightFieldGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
physx_PxHeightField_Pod* heightField;
float heightScale;
float rowScale;
float columnScale;
uint8_t heightFieldFlags;
char structgen_pad1[3];
};
struct physx_PxBounds3_Pod {
physx_PxVec3_Pod minimum;
physx_PxVec3_Pod maximum;
};
struct physx_PxVec4_Pod {
float x;
float y;
float z;
float w;
};
struct physx_PxParticleSystemGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
int32_t mSolverType;
};
struct physx_PxHairSystemGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
};
struct physx_PxTetrahedronMeshGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
physx_PxTetrahedronMesh_Pod* tetrahedronMesh;
};
struct physx_PxQueryHit_Pod {
uint32_t faceIndex;
};
struct physx_PxLocationHit_Pod {
uint32_t faceIndex;
uint16_t flags;
char structgen_pad0[2];
physx_PxVec3_Pod position;
physx_PxVec3_Pod normal;
float distance;
};
struct physx_PxGeomRaycastHit_Pod {
uint32_t faceIndex;
uint16_t flags;
char structgen_pad0[2];
physx_PxVec3_Pod position;
physx_PxVec3_Pod normal;
float distance;
float u;
float v;
};
struct physx_PxGeomOverlapHit_Pod {
uint32_t faceIndex;
};
struct physx_PxGeomSweepHit_Pod {
uint32_t faceIndex;
uint16_t flags;
char structgen_pad0[2];
physx_PxVec3_Pod position;
physx_PxVec3_Pod normal;
float distance;
};
struct physx_PxGeomIndexPair_Pod {
uint32_t id0;
uint32_t id1;
};
struct physx_PxQueryThreadContext_Pod {
char structgen_pad0[1];
};
struct physx_PxContactBuffer_Pod;
struct physx_PxRenderOutput_Pod;
struct physx_PxMassProperties_Pod;
struct physx_PxCustomGeometryType_Pod {
char structgen_pad0[4];
};
struct physx_PxCustomGeometryCallbacks_Pod {
void* vtable_;
};
struct physx_PxCustomGeometry_Pod {
char structgen_pad0[4];
float mTypePadding;
physx_PxCustomGeometryCallbacks_Pod* callbacks;
};
struct physx_PxGeometryHolder_Pod {
char structgen_pad0[56];
};
struct physx_PxFilterData_Pod;
struct physx_PxBaseMaterial_Pod;
struct physx_PxShape_Pod {
char structgen_pad0[16];
void* userData;
};

View File

@@ -0,0 +1,324 @@
---
source: physx-sys/pxbind/tests/structgen.rs
expression: generated.rust
---
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxDeserializationContext {
pub structgen_pad0: [u8; 16],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxBase {
pub structgen_pad0: [u8; 16],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxRefCounted {
pub structgen_pad0: [u8; 16],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxVec3 {
pub x: f32,
pub y: f32,
pub z: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxVec3Padded {
pub x: f32,
pub y: f32,
pub z: f32,
pub padding: u32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxQuat {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxTransform {
pub q: PxQuat,
pub p: PxVec3,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxTransformPadded {
pub transform: PxTransform,
pub padding: u32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxPlane {
pub n: PxVec3,
pub d: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxBoxGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
pub halfExtents: PxVec3,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxSphereGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
pub radius: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxCapsuleGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
pub radius: f32,
pub halfHeight: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxPlaneGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxMat33 {
pub column0: PxVec3,
pub column1: PxVec3,
pub column2: PxVec3,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxMeshScale {
pub scale: PxVec3,
pub rotation: PxQuat,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxStridedData {
pub stride: u32,
pub structgen_pad0: [u8; 4],
pub data: *const std::ffi::c_void,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxBoundedData {
pub stride: u32,
pub structgen_pad0: [u8; 4],
pub data: *const std::ffi::c_void,
pub count: u32,
pub structgen_pad1: [u8; 4],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxHullPolygon {
pub mPlane: [f32; 4],
pub mNbVerts: u16,
pub mIndexBase: u16,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxConvexMesh {
pub structgen_pad0: [u8; 16],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxConvexMeshGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
pub scale: PxMeshScale,
pub structgen_pad1: [u8; 4],
pub convexMesh: *mut PxConvexMesh,
pub meshFlags: PxConvexMeshGeometryFlags,
pub structgen_pad2: [u8; 7],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxTriangleMeshGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
pub scale: PxMeshScale,
pub meshFlags: PxMeshGeometryFlags,
pub structgen_pad1: [u8; 3],
pub triangleMesh: *mut PxTriangleMesh,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxHeightFieldGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
pub heightField: *mut PxHeightField,
pub heightScale: f32,
pub rowScale: f32,
pub columnScale: f32,
pub heightFieldFlags: PxMeshGeometryFlags,
pub structgen_pad1: [u8; 3],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxBounds3 {
pub minimum: PxVec3,
pub maximum: PxVec3,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxVec4 {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxParticleSystemGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
pub mSolverType: PxParticleSolverType,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxHairSystemGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxTetrahedronMeshGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
pub tetrahedronMesh: *mut PxTetrahedronMesh,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxQueryHit {
pub faceIndex: u32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxLocationHit {
pub faceIndex: u32,
pub flags: PxHitFlags,
pub structgen_pad0: [u8; 2],
pub position: PxVec3,
pub normal: PxVec3,
pub distance: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxGeomRaycastHit {
pub faceIndex: u32,
pub flags: PxHitFlags,
pub structgen_pad0: [u8; 2],
pub position: PxVec3,
pub normal: PxVec3,
pub distance: f32,
pub u: f32,
pub v: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxGeomOverlapHit {
pub faceIndex: u32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxGeomSweepHit {
pub faceIndex: u32,
pub flags: PxHitFlags,
pub structgen_pad0: [u8; 2],
pub position: PxVec3,
pub normal: PxVec3,
pub distance: f32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxGeomIndexPair {
pub id0: u32,
pub id1: u32,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxQueryThreadContext {
pub structgen_pad0: [u8; 1],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxCustomGeometryType {
pub structgen_pad0: [u8; 4],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxCustomGeometry {
pub structgen_pad0: [u8; 4],
pub mTypePadding: f32,
pub callbacks: *mut PxCustomGeometryCallbacks,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxGeometryHolder {
pub structgen_pad0: [u8; 56],
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxShape {
pub structgen_pad0: [u8; 16],
pub userData: *mut std::ffi::c_void,
}
#[cfg(test)]
mod sizes {
#[test]
fn check_sizes() {
assert_eq!(std::mem::size_of::<PxDeserializationContext>(), 16);
assert_eq!(std::mem::size_of::<PxBase>(), 16);
assert_eq!(std::mem::size_of::<PxRefCounted>(), 16);
assert_eq!(std::mem::size_of::<PxGeometry>(), 8);
assert_eq!(std::mem::size_of::<PxVec3>(), 12);
assert_eq!(std::mem::size_of::<PxVec3Padded>(), 16);
assert_eq!(std::mem::size_of::<PxQuat>(), 16);
assert_eq!(std::mem::size_of::<PxTransform>(), 28);
assert_eq!(std::mem::size_of::<PxTransformPadded>(), 32);
assert_eq!(std::mem::size_of::<PxPlane>(), 16);
assert_eq!(std::mem::size_of::<PxBoxGeometry>(), 20);
assert_eq!(std::mem::size_of::<PxSphereGeometry>(), 12);
assert_eq!(std::mem::size_of::<PxCapsuleGeometry>(), 16);
assert_eq!(std::mem::size_of::<PxPlaneGeometry>(), 8);
assert_eq!(std::mem::size_of::<PxMat33>(), 36);
assert_eq!(std::mem::size_of::<PxMeshScale>(), 28);
assert_eq!(std::mem::size_of::<PxStridedData>(), 16);
assert_eq!(std::mem::size_of::<PxBoundedData>(), 24);
assert_eq!(std::mem::size_of::<PxHullPolygon>(), 20);
assert_eq!(std::mem::size_of::<PxConvexMesh>(), 16);
assert_eq!(std::mem::size_of::<PxConvexMeshGeometry>(), 56);
assert_eq!(std::mem::size_of::<PxTriangleMeshGeometry>(), 48);
assert_eq!(std::mem::size_of::<PxHeightFieldGeometry>(), 32);
assert_eq!(std::mem::size_of::<PxBounds3>(), 24);
assert_eq!(std::mem::size_of::<PxVec4>(), 16);
assert_eq!(std::mem::size_of::<PxParticleSystemGeometry>(), 12);
assert_eq!(std::mem::size_of::<PxHairSystemGeometry>(), 8);
assert_eq!(std::mem::size_of::<PxTetrahedronMeshGeometry>(), 16);
assert_eq!(std::mem::size_of::<PxQueryHit>(), 4);
assert_eq!(std::mem::size_of::<PxLocationHit>(), 36);
assert_eq!(std::mem::size_of::<PxGeomRaycastHit>(), 44);
assert_eq!(std::mem::size_of::<PxGeomOverlapHit>(), 4);
assert_eq!(std::mem::size_of::<PxGeomSweepHit>(), 36);
assert_eq!(std::mem::size_of::<PxGeomIndexPair>(), 8);
assert_eq!(std::mem::size_of::<PxQueryThreadContext>(), 1);
assert_eq!(std::mem::size_of::<PxCustomGeometryType>(), 4);
assert_eq!(std::mem::size_of::<PxCustomGeometry>(), 16);
assert_eq!(std::mem::size_of::<PxGeometryHolder>(), 56);
assert_eq!(std::mem::size_of::<PxShape>(), 24);
}
}

View File

@@ -0,0 +1,488 @@
---
source: physx-sys/pxbind/tests/structgen.rs
expression: sg
---
// Automatically generated by pxbind
#include "PxPhysicsAPI.h"
using namespace physx;
#define unsafe_offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
#include "structgen.hpp"
int main() {
PodStructGen sg;
sg.pass_thru("struct physx_PxAllocatorCallback_Pod;\n");
sg.pass_thru("struct physx_PxErrorCallback_Pod;\n");
sg.pass_thru("struct physx_PxAssertHandler_Pod;\n");
sg.pass_thru("struct physx_PxInputStream_Pod;\n");
sg.pass_thru("struct physx_PxInputData_Pod;\n");
sg.pass_thru("struct physx_PxOutputStream_Pod;\n");
sg.pass_thru("struct physx_PxVec2_Pod;\n");
sg.pass_thru("struct physx_PxVec3_Pod;\n");
sg.pass_thru("struct physx_PxVec4_Pod;\n");
sg.pass_thru("struct physx_PxQuat_Pod;\n");
sg.pass_thru("struct physx_PxMat33_Pod;\n");
sg.pass_thru("struct physx_PxMat34_Pod;\n");
sg.pass_thru("struct physx_PxMat44_Pod;\n");
sg.pass_thru("struct physx_PxTransform_Pod;\n");
sg.pass_thru("struct physx_PxPlane_Pod;\n");
sg.pass_thru("struct physx_PxBounds3_Pod;\n");
sg.pass_thru("struct physx_PxBase_Pod;\n");
sg.pass_thru("struct physx_PxSerializationContext_Pod;\n");
sg.pass_thru("struct physx_PxRepXSerializer_Pod;\n");
sg.pass_thru("struct physx_PxSerializer_Pod;\n");
sg.pass_thru("struct physx_PxPhysics_Pod;\n");
sg.pass_thru("struct physx_PxCollection_Pod;\n");
sg.pass_thru("struct physx_PxProcessPxBaseCallback_Pod {\n void* vtable_;\n};\n");
sg.pass_thru("struct physx_PxSerializationContext_Pod {\n void* vtable_;\n};\n");
struct physx_PxDeserializationContext_Pod: public physx::PxDeserializationContext {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxDeserializationContext_Pod", "PxDeserializationContext");
sg.end_struct(sizeof(physx::PxDeserializationContext));
}
};
physx_PxDeserializationContext_Pod::dump_layout(sg);
sg.pass_thru("struct physx_PxSerializationRegistry_Pod {\n void* vtable_;\n};\n");
sg.pass_thru("struct physx_PxCollection_Pod {\n void* vtable_;\n};\n");
sg.pass_thru("struct physx_PxTypeInfo_Pod;\n");
sg.pass_thru("struct physx_PxMaterial_Pod;\n");
sg.pass_thru("struct physx_PxFEMSoftBodyMaterial_Pod;\n");
sg.pass_thru("struct physx_PxFEMClothMaterial_Pod;\n");
sg.pass_thru("struct physx_PxPBDMaterial_Pod;\n");
sg.pass_thru("struct physx_PxFLIPMaterial_Pod;\n");
sg.pass_thru("struct physx_PxMPMMaterial_Pod;\n");
sg.pass_thru("struct physx_PxCustomMaterial_Pod;\n");
sg.pass_thru("struct physx_PxConvexMesh_Pod;\n");
sg.pass_thru("struct physx_PxTriangleMesh_Pod;\n");
sg.pass_thru("struct physx_PxBVH33TriangleMesh_Pod;\n");
sg.pass_thru("struct physx_PxBVH34TriangleMesh_Pod;\n");
sg.pass_thru("struct physx_PxTetrahedronMesh_Pod;\n");
sg.pass_thru("struct physx_PxHeightField_Pod;\n");
sg.pass_thru("struct physx_PxActor_Pod;\n");
sg.pass_thru("struct physx_PxRigidActor_Pod;\n");
sg.pass_thru("struct physx_PxRigidBody_Pod;\n");
sg.pass_thru("struct physx_PxRigidDynamic_Pod;\n");
sg.pass_thru("struct physx_PxRigidStatic_Pod;\n");
sg.pass_thru("struct physx_PxArticulationLink_Pod;\n");
sg.pass_thru("struct physx_PxArticulationJointReducedCoordinate_Pod;\n");
sg.pass_thru("struct physx_PxArticulationReducedCoordinate_Pod;\n");
sg.pass_thru("struct physx_PxAggregate_Pod;\n");
sg.pass_thru("struct physx_PxConstraint_Pod;\n");
sg.pass_thru("struct physx_PxShape_Pod;\n");
sg.pass_thru("struct physx_PxPruningStructure_Pod;\n");
sg.pass_thru("struct physx_PxParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxPBDParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxFLIPParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxMPMParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxCustomParticleSystem_Pod;\n");
sg.pass_thru("struct physx_PxSoftBody_Pod;\n");
sg.pass_thru("struct physx_PxFEMCloth_Pod;\n");
sg.pass_thru("struct physx_PxHairSystem_Pod;\n");
sg.pass_thru("struct physx_PxParticleBuffer_Pod;\n");
sg.pass_thru("struct physx_PxParticleAndDiffuseBuffer_Pod;\n");
sg.pass_thru("struct physx_PxParticleClothBuffer_Pod;\n");
sg.pass_thru("struct physx_PxParticleRigidBuffer_Pod;\n");
sg.pass_thru("struct physx_PxAssertHandler_Pod {\n void* vtable_;\n};\n");
struct physx_PxBase_Pod: public physx::PxBase {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxBase_Pod", "PxBase");
sg.end_struct(sizeof(physx::PxBase));
}
};
physx_PxBase_Pod::dump_layout(sg);
struct physx_PxRefCounted_Pod: public physx::PxRefCounted {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxRefCounted_Pod", "PxRefCounted");
sg.end_struct(sizeof(physx::PxRefCounted));
}
};
physx_PxRefCounted_Pod::dump_layout(sg);
struct physx_PxGeometry_Pod: public physx::PxGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxGeometry_Pod", "PxGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxGeometry_Pod, mTypePadding));
sg.end_struct(sizeof(physx::PxGeometry));
}
};
physx_PxGeometry_Pod::dump_layout(sg);
struct physx_PxVec3_Pod: public physx::PxVec3 {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxVec3_Pod", "PxVec3");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3_Pod, z));
sg.end_struct(sizeof(physx::PxVec3));
}
};
physx_PxVec3_Pod::dump_layout(sg);
struct physx_PxVec3Padded_Pod: public physx::PxVec3Padded {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxVec3Padded_Pod", "PxVec3Padded");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3Padded_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3Padded_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxVec3Padded_Pod, z));
sg.add_field("uint32_t padding", "padding", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxVec3Padded_Pod, padding));
sg.end_struct(sizeof(physx::PxVec3Padded));
}
};
physx_PxVec3Padded_Pod::dump_layout(sg);
struct physx_PxQuat_Pod: public physx::PxQuat {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxQuat_Pod", "PxQuat");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, z));
sg.add_field("float w", "w", "f32", sizeof(float), unsafe_offsetof(physx_PxQuat_Pod, w));
sg.end_struct(sizeof(physx::PxQuat));
}
};
physx_PxQuat_Pod::dump_layout(sg);
struct physx_PxTransform_Pod: public physx::PxTransform {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTransform_Pod", "PxTransform");
sg.add_field("physx_PxQuat_Pod q", "q", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxTransform_Pod, q));
sg.add_field("physx_PxVec3_Pod p", "p", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxTransform_Pod, p));
sg.end_struct(sizeof(physx::PxTransform));
}
};
physx_PxTransform_Pod::dump_layout(sg);
struct physx_PxTransformPadded_Pod: public physx::PxTransformPadded {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTransformPadded_Pod", "PxTransformPadded");
sg.add_field("physx_PxTransform_Pod transform", "transform", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxTransformPadded_Pod, transform));
sg.add_field("uint32_t padding", "padding", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTransformPadded_Pod, padding));
sg.end_struct(sizeof(physx::PxTransformPadded));
}
};
physx_PxTransformPadded_Pod::dump_layout(sg);
struct physx_PxPlane_Pod: public physx::PxPlane {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxPlane_Pod", "PxPlane");
sg.add_field("physx_PxVec3_Pod n", "n", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxPlane_Pod, n));
sg.add_field("float d", "d", "f32", sizeof(float), unsafe_offsetof(physx_PxPlane_Pod, d));
sg.end_struct(sizeof(physx::PxPlane));
}
};
physx_PxPlane_Pod::dump_layout(sg);
struct physx_PxBoxGeometry_Pod: public physx::PxBoxGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxBoxGeometry_Pod", "PxBoxGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxGeometry_Pod, mTypePadding));
sg.add_field("physx_PxVec3_Pod halfExtents", "halfExtents", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxBoxGeometry_Pod, halfExtents));
sg.end_struct(sizeof(physx::PxBoxGeometry));
}
};
physx_PxBoxGeometry_Pod::dump_layout(sg);
struct physx_PxSphereGeometry_Pod: public physx::PxSphereGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxSphereGeometry_Pod", "PxSphereGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxSphereGeometry_Pod, mTypePadding));
sg.add_field("float radius", "radius", "f32", sizeof(float), unsafe_offsetof(physx_PxSphereGeometry_Pod, radius));
sg.end_struct(sizeof(physx::PxSphereGeometry));
}
};
physx_PxSphereGeometry_Pod::dump_layout(sg);
struct physx_PxCapsuleGeometry_Pod: public physx::PxCapsuleGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxCapsuleGeometry_Pod", "PxCapsuleGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleGeometry_Pod, mTypePadding));
sg.add_field("float radius", "radius", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleGeometry_Pod, radius));
sg.add_field("float halfHeight", "halfHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleGeometry_Pod, halfHeight));
sg.end_struct(sizeof(physx::PxCapsuleGeometry));
}
};
physx_PxCapsuleGeometry_Pod::dump_layout(sg);
struct physx_PxPlaneGeometry_Pod: public physx::PxPlaneGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxPlaneGeometry_Pod", "PxPlaneGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxPlaneGeometry_Pod, mTypePadding));
sg.end_struct(sizeof(physx::PxPlaneGeometry));
}
};
physx_PxPlaneGeometry_Pod::dump_layout(sg);
struct physx_PxMat33_Pod: public physx::PxMat33 {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxMat33_Pod", "PxMat33");
sg.add_field("physx_PxVec3_Pod column0", "column0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxMat33_Pod, column0));
sg.add_field("physx_PxVec3_Pod column1", "column1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxMat33_Pod, column1));
sg.add_field("physx_PxVec3_Pod column2", "column2", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxMat33_Pod, column2));
sg.end_struct(sizeof(physx::PxMat33));
}
};
physx_PxMat33_Pod::dump_layout(sg);
struct physx_PxMeshScale_Pod: public physx::PxMeshScale {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxMeshScale_Pod", "PxMeshScale");
sg.add_field("physx_PxVec3_Pod scale", "scale", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxMeshScale_Pod, scale));
sg.add_field("physx_PxQuat_Pod rotation", "rotation", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxMeshScale_Pod, rotation));
sg.end_struct(sizeof(physx::PxMeshScale));
}
};
physx_PxMeshScale_Pod::dump_layout(sg);
struct physx_PxStridedData_Pod: public physx::PxStridedData {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxStridedData_Pod", "PxStridedData");
sg.add_field("uint32_t stride", "stride", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxStridedData_Pod, stride));
sg.add_field("void const* data", "data", "*const std::ffi::c_void", sizeof(void const*), unsafe_offsetof(physx_PxStridedData_Pod, data));
sg.end_struct(sizeof(physx::PxStridedData));
}
};
physx_PxStridedData_Pod::dump_layout(sg);
struct physx_PxBoundedData_Pod: public physx::PxBoundedData {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxBoundedData_Pod", "PxBoundedData");
sg.add_field("uint32_t stride", "stride", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBoundedData_Pod, stride));
sg.add_field("void const* data", "data", "*const std::ffi::c_void", sizeof(void const*), unsafe_offsetof(physx_PxBoundedData_Pod, data));
sg.add_field("uint32_t count", "count", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBoundedData_Pod, count));
sg.end_struct(sizeof(physx::PxBoundedData));
}
};
physx_PxBoundedData_Pod::dump_layout(sg);
struct physx_PxHullPolygon_Pod: public physx::PxHullPolygon {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxHullPolygon_Pod", "PxHullPolygon");
sg.add_field("float mPlane[4]", "mPlane", "[f32; 4]", sizeof(float[4]), unsafe_offsetof(physx_PxHullPolygon_Pod, mPlane));
sg.add_field("uint16_t mNbVerts", "mNbVerts", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxHullPolygon_Pod, mNbVerts));
sg.add_field("uint16_t mIndexBase", "mIndexBase", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxHullPolygon_Pod, mIndexBase));
sg.end_struct(sizeof(physx::PxHullPolygon));
}
};
physx_PxHullPolygon_Pod::dump_layout(sg);
struct physx_PxConvexMesh_Pod: public physx::PxConvexMesh {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxConvexMesh_Pod", "PxConvexMesh");
sg.end_struct(sizeof(physx::PxConvexMesh));
}
};
physx_PxConvexMesh_Pod::dump_layout(sg);
struct physx_PxConvexMeshGeometry_Pod: public physx::PxConvexMeshGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxConvexMeshGeometry_Pod", "PxConvexMeshGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxConvexMeshGeometry_Pod, mTypePadding));
sg.add_field("physx_PxMeshScale_Pod scale", "scale", "PxMeshScale", sizeof(physx::PxMeshScale), unsafe_offsetof(physx_PxConvexMeshGeometry_Pod, scale));
sg.add_field("physx_PxConvexMesh_Pod* convexMesh", "convexMesh", "*mut PxConvexMesh", sizeof(physx::PxConvexMesh*), unsafe_offsetof(physx_PxConvexMeshGeometry_Pod, convexMesh));
sg.add_field("uint8_t meshFlags", "meshFlags", "PxConvexMeshGeometryFlags", sizeof(physx::PxConvexMeshGeometryFlags), unsafe_offsetof(physx_PxConvexMeshGeometry_Pod, meshFlags));
sg.end_struct(sizeof(physx::PxConvexMeshGeometry));
}
};
physx_PxConvexMeshGeometry_Pod::dump_layout(sg);
struct physx_PxTriangleMeshGeometry_Pod: public physx::PxTriangleMeshGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTriangleMeshGeometry_Pod", "PxTriangleMeshGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxTriangleMeshGeometry_Pod, mTypePadding));
sg.add_field("physx_PxMeshScale_Pod scale", "scale", "PxMeshScale", sizeof(physx::PxMeshScale), unsafe_offsetof(physx_PxTriangleMeshGeometry_Pod, scale));
sg.add_field("uint8_t meshFlags", "meshFlags", "PxMeshGeometryFlags", sizeof(physx::PxMeshGeometryFlags), unsafe_offsetof(physx_PxTriangleMeshGeometry_Pod, meshFlags));
sg.add_field("physx_PxTriangleMesh_Pod* triangleMesh", "triangleMesh", "*mut PxTriangleMesh", sizeof(physx::PxTriangleMesh*), unsafe_offsetof(physx_PxTriangleMeshGeometry_Pod, triangleMesh));
sg.end_struct(sizeof(physx::PxTriangleMeshGeometry));
}
};
physx_PxTriangleMeshGeometry_Pod::dump_layout(sg);
struct physx_PxHeightFieldGeometry_Pod: public physx::PxHeightFieldGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxHeightFieldGeometry_Pod", "PxHeightFieldGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxHeightFieldGeometry_Pod, mTypePadding));
sg.add_field("physx_PxHeightField_Pod* heightField", "heightField", "*mut PxHeightField", sizeof(physx::PxHeightField*), unsafe_offsetof(physx_PxHeightFieldGeometry_Pod, heightField));
sg.add_field("float heightScale", "heightScale", "f32", sizeof(float), unsafe_offsetof(physx_PxHeightFieldGeometry_Pod, heightScale));
sg.add_field("float rowScale", "rowScale", "f32", sizeof(float), unsafe_offsetof(physx_PxHeightFieldGeometry_Pod, rowScale));
sg.add_field("float columnScale", "columnScale", "f32", sizeof(float), unsafe_offsetof(physx_PxHeightFieldGeometry_Pod, columnScale));
sg.add_field("uint8_t heightFieldFlags", "heightFieldFlags", "PxMeshGeometryFlags", sizeof(physx::PxMeshGeometryFlags), unsafe_offsetof(physx_PxHeightFieldGeometry_Pod, heightFieldFlags));
sg.end_struct(sizeof(physx::PxHeightFieldGeometry));
}
};
physx_PxHeightFieldGeometry_Pod::dump_layout(sg);
struct physx_PxBounds3_Pod: public physx::PxBounds3 {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxBounds3_Pod", "PxBounds3");
sg.add_field("physx_PxVec3_Pod minimum", "minimum", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxBounds3_Pod, minimum));
sg.add_field("physx_PxVec3_Pod maximum", "maximum", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxBounds3_Pod, maximum));
sg.end_struct(sizeof(physx::PxBounds3));
}
};
physx_PxBounds3_Pod::dump_layout(sg);
struct physx_PxVec4_Pod: public physx::PxVec4 {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxVec4_Pod", "PxVec4");
sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec4_Pod, x));
sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec4_Pod, y));
sg.add_field("float z", "z", "f32", sizeof(float), unsafe_offsetof(physx_PxVec4_Pod, z));
sg.add_field("float w", "w", "f32", sizeof(float), unsafe_offsetof(physx_PxVec4_Pod, w));
sg.end_struct(sizeof(physx::PxVec4));
}
};
physx_PxVec4_Pod::dump_layout(sg);
struct physx_PxParticleSystemGeometry_Pod: public physx::PxParticleSystemGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxParticleSystemGeometry_Pod", "PxParticleSystemGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxParticleSystemGeometry_Pod, mTypePadding));
sg.add_field("int32_t mSolverType", "mSolverType", "PxParticleSolverType", sizeof(physx::PxParticleSolverType::Enum), unsafe_offsetof(physx_PxParticleSystemGeometry_Pod, mSolverType));
sg.end_struct(sizeof(physx::PxParticleSystemGeometry));
}
};
physx_PxParticleSystemGeometry_Pod::dump_layout(sg);
struct physx_PxHairSystemGeometry_Pod: public physx::PxHairSystemGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxHairSystemGeometry_Pod", "PxHairSystemGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxHairSystemGeometry_Pod, mTypePadding));
sg.end_struct(sizeof(physx::PxHairSystemGeometry));
}
};
physx_PxHairSystemGeometry_Pod::dump_layout(sg);
struct physx_PxTetrahedronMeshGeometry_Pod: public physx::PxTetrahedronMeshGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxTetrahedronMeshGeometry_Pod", "PxTetrahedronMeshGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxTetrahedronMeshGeometry_Pod, mTypePadding));
sg.add_field("physx_PxTetrahedronMesh_Pod* tetrahedronMesh", "tetrahedronMesh", "*mut PxTetrahedronMesh", sizeof(physx::PxTetrahedronMesh*), unsafe_offsetof(physx_PxTetrahedronMeshGeometry_Pod, tetrahedronMesh));
sg.end_struct(sizeof(physx::PxTetrahedronMeshGeometry));
}
};
physx_PxTetrahedronMeshGeometry_Pod::dump_layout(sg);
struct physx_PxQueryHit_Pod: public physx::PxQueryHit {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxQueryHit_Pod", "PxQueryHit");
sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxQueryHit_Pod, faceIndex));
sg.end_struct(sizeof(physx::PxQueryHit));
}
};
physx_PxQueryHit_Pod::dump_layout(sg);
struct physx_PxLocationHit_Pod: public physx::PxLocationHit {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxLocationHit_Pod", "PxLocationHit");
sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxLocationHit_Pod, faceIndex));
sg.add_field("uint16_t flags", "flags", "PxHitFlags", sizeof(physx::PxHitFlags), unsafe_offsetof(physx_PxLocationHit_Pod, flags));
sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxLocationHit_Pod, position));
sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxLocationHit_Pod, normal));
sg.add_field("float distance", "distance", "f32", sizeof(float), unsafe_offsetof(physx_PxLocationHit_Pod, distance));
sg.end_struct(sizeof(physx::PxLocationHit));
}
};
physx_PxLocationHit_Pod::dump_layout(sg);
struct physx_PxGeomRaycastHit_Pod: public physx::PxGeomRaycastHit {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxGeomRaycastHit_Pod", "PxGeomRaycastHit");
sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGeomRaycastHit_Pod, faceIndex));
sg.add_field("uint16_t flags", "flags", "PxHitFlags", sizeof(physx::PxHitFlags), unsafe_offsetof(physx_PxGeomRaycastHit_Pod, flags));
sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxGeomRaycastHit_Pod, position));
sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxGeomRaycastHit_Pod, normal));
sg.add_field("float distance", "distance", "f32", sizeof(float), unsafe_offsetof(physx_PxGeomRaycastHit_Pod, distance));
sg.add_field("float u", "u", "f32", sizeof(float), unsafe_offsetof(physx_PxGeomRaycastHit_Pod, u));
sg.add_field("float v", "v", "f32", sizeof(float), unsafe_offsetof(physx_PxGeomRaycastHit_Pod, v));
sg.end_struct(sizeof(physx::PxGeomRaycastHit));
}
};
physx_PxGeomRaycastHit_Pod::dump_layout(sg);
struct physx_PxGeomOverlapHit_Pod: public physx::PxGeomOverlapHit {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxGeomOverlapHit_Pod", "PxGeomOverlapHit");
sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGeomOverlapHit_Pod, faceIndex));
sg.end_struct(sizeof(physx::PxGeomOverlapHit));
}
};
physx_PxGeomOverlapHit_Pod::dump_layout(sg);
struct physx_PxGeomSweepHit_Pod: public physx::PxGeomSweepHit {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxGeomSweepHit_Pod", "PxGeomSweepHit");
sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGeomSweepHit_Pod, faceIndex));
sg.add_field("uint16_t flags", "flags", "PxHitFlags", sizeof(physx::PxHitFlags), unsafe_offsetof(physx_PxGeomSweepHit_Pod, flags));
sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxGeomSweepHit_Pod, position));
sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxGeomSweepHit_Pod, normal));
sg.add_field("float distance", "distance", "f32", sizeof(float), unsafe_offsetof(physx_PxGeomSweepHit_Pod, distance));
sg.end_struct(sizeof(physx::PxGeomSweepHit));
}
};
physx_PxGeomSweepHit_Pod::dump_layout(sg);
struct physx_PxGeomIndexPair_Pod: public physx::PxGeomIndexPair {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxGeomIndexPair_Pod", "PxGeomIndexPair");
sg.add_field("uint32_t id0", "id0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGeomIndexPair_Pod, id0));
sg.add_field("uint32_t id1", "id1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGeomIndexPair_Pod, id1));
sg.end_struct(sizeof(physx::PxGeomIndexPair));
}
};
physx_PxGeomIndexPair_Pod::dump_layout(sg);
struct physx_PxQueryThreadContext_Pod: public physx::PxQueryThreadContext {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxQueryThreadContext_Pod", "PxQueryThreadContext");
sg.end_struct(sizeof(physx::PxQueryThreadContext));
}
};
physx_PxQueryThreadContext_Pod::dump_layout(sg);
sg.pass_thru("struct physx_PxContactBuffer_Pod;\n");
sg.pass_thru("struct physx_PxRenderOutput_Pod;\n");
sg.pass_thru("struct physx_PxMassProperties_Pod;\n");
struct physx_PxCustomGeometryType_Pod: public physx::PxCustomGeometryType {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxCustomGeometryType_Pod", "PxCustomGeometryType");
sg.end_struct(sizeof(physx::PxCustomGeometryType));
}
};
physx_PxCustomGeometryType_Pod::dump_layout(sg);
sg.pass_thru("struct physx_PxCustomGeometryCallbacks_Pod {\n void* vtable_;\n};\n");
struct physx_PxCustomGeometry_Pod: public physx::PxCustomGeometry {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxCustomGeometry_Pod", "PxCustomGeometry");
sg.add_field("float mTypePadding", "mTypePadding", "f32", sizeof(float), unsafe_offsetof(physx_PxCustomGeometry_Pod, mTypePadding));
sg.add_field("physx_PxCustomGeometryCallbacks_Pod* callbacks", "callbacks", "*mut PxCustomGeometryCallbacks", sizeof(physx::PxCustomGeometryCallbacks*), unsafe_offsetof(physx_PxCustomGeometry_Pod, callbacks));
sg.end_struct(sizeof(physx::PxCustomGeometry));
}
};
physx_PxCustomGeometry_Pod::dump_layout(sg);
struct physx_PxGeometryHolder_Pod: public physx::PxGeometryHolder {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxGeometryHolder_Pod", "PxGeometryHolder");
sg.end_struct(sizeof(physx::PxGeometryHolder));
}
};
physx_PxGeometryHolder_Pod::dump_layout(sg);
sg.pass_thru("struct physx_PxFilterData_Pod;\n");
sg.pass_thru("struct physx_PxBaseMaterial_Pod;\n");
struct physx_PxShape_Pod: public physx::PxShape {
static void dump_layout(PodStructGen& sg) {
sg.begin_struct("physx_PxShape_Pod", "PxShape");
sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxShape_Pod, userData));
sg.end_struct(sizeof(physx::PxShape));
}
};
physx_PxShape_Pod::dump_layout(sg);
sg.finish();
}

View File

@@ -0,0 +1,87 @@
#include <cassert>
#include <cstdio>
#include <cstdint>
#include <vector>
struct RustCheck {
const char* rname;
uint32_t size;
};
struct PodStructGen {
PodStructGen() {
cfile = fopen("structgen_out.hpp", "w");
rfile = fopen("structgen_out.rs", "w");
}
void finish() {
fclose(cfile);
fputs("#[cfg(test)]\nmod sizes {\n #[test]\n fn check_sizes() {\n", rfile);
for (const auto& rc : rust_checks) {
fprintf(
rfile,
" assert_eq!(std::mem::size_of::<%s>(), %u);\n",
rc.rname,
rc.size
);
}
fputs(" }\n}\n", rfile);
fclose(rfile);
}
void pass_thru(const char* code) { fputs(code, cfile); }
void begin_struct(const char* cname, const char* rname) {
fprintf(cfile, "struct %s {\n", cname);
fprintf(rfile, "#[derive(Clone, Copy)]\n");
fprintf(rfile, "#[repr(C)]\n");
fprintf(rfile, "pub struct %s {\n", rname);
this->rname = rname;
pos = 0;
padIdx = 0;
}
void emit_padding(uint32_t bytes) {
fprintf(cfile, " char structgen_pad%u[%u];\n", padIdx, bytes);
fprintf(rfile, " pub structgen_pad%u: [u8; %u],\n", padIdx, bytes);
++padIdx;
}
void add_field(
const char* cppDecl,
const char* rustName,
const char* rustType,
size_t size,
size_t offset) {
assert(offset >= pos);
if (offset > pos) {
emit_padding(uint32_t(offset - pos));
pos = offset;
}
fprintf(cfile, " %s;\n", cppDecl);
fprintf(rfile, " pub %s: %s,\n", rustName, rustType);
pos += size;
}
void end_struct(size_t size) {
assert(size >= pos);
if (size > pos) {
emit_padding(uint32_t(size - pos));
}
fputs("};\n", cfile);
fputs("}\n", rfile);
rust_checks.emplace_back(RustCheck { rname, uint32_t(size) });
}
private:
std::vector<RustCheck> rust_checks;
FILE* cfile;
FILE* rfile;
const char* rname;
size_t pos;
uint32_t padIdx;
};

View File

@@ -0,0 +1,88 @@
fn gen_structgen(which: &str, _to_emit: &'static [&str]) -> anyhow::Result<String> {
let (ast, _) = pxbind::get_parsed_ast(format!("tests/data/{which}"))?;
let mut consumer = pxbind::consumer::AstConsumer::default();
consumer.consume(&ast)?;
let record_filter = |rb: &pxbind::consumer::RecBinding<'_>| rb.name().starts_with("Px");
let generator = pxbind::generator::Generator {
record_filter: Box::new(record_filter),
..Default::default()
};
let structgen = {
let mut sg = Vec::new();
generator.generate_structgen(&consumer, &mut sg)?;
String::from_utf8(sg)?
};
Ok(structgen)
}
struct StructgenOut {
cpp: String,
rust: String,
}
fn run_structgen(sg: String) -> anyhow::Result<StructgenOut> {
let td = tempfile::tempdir()?;
let tp = td.path();
let sg_src = tp.join("structgen.cpp");
std::fs::write(&sg_src, sg)?;
std::fs::copy("tests/structgen.hpp", tp.join("structgen.hpp"))?;
// Compile the structgen program for the host target
let mut cmd = std::process::Command::new("clang++");
cmd.current_dir(&td);
let include_dir = pxbind::get_include_dir()?;
cmd.args([
"-fuse-ld=lld",
"-std=c++11",
"-fcolor-diagnostics",
"-o",
"structgen",
"-DNDEBUG",
"-I",
]);
cmd.arg(include_dir);
cmd.arg(&sg_src);
anyhow::ensure!(cmd.status()?.success(), "failed to compile structgen");
let mut sg = std::process::Command::new(tp.join("structgen"));
sg.current_dir(tp);
anyhow::ensure!(sg.status()?.success(), "failed to run structgen");
let cpp = std::fs::read_to_string(tp.join("structgen_out.hpp"))?;
let rust = std::fs::read_to_string(tp.join("structgen_out.rs"))?;
Ok(StructgenOut { cpp, rust })
}
#[test]
fn many_things() {
let sg = gen_structgen("functions/methods_complex.h", &[]).unwrap();
insta::assert_snapshot!(sg);
let generated = run_structgen(sg).unwrap();
insta::assert_snapshot!(generated.cpp);
insta::assert_snapshot!(generated.rust);
}
#[test]
fn all_the_things() {
let sg = gen_structgen("all_the_things.h", &[]).unwrap();
insta::assert_snapshot!(sg);
let generated = run_structgen(sg).unwrap();
insta::assert_snapshot!(generated.cpp);
insta::assert_snapshot!(generated.rust);
}