support bitflags generate

This commit is contained in:
neuecc 2023-04-15 01:23:42 +09:00
parent e757b45942
commit a8311b8231
8 changed files with 534 additions and 55 deletions

1
.vscode/tasks.json vendored
View File

@ -11,6 +11,7 @@
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
}, },
"args": ["-vv"],
"label": "rust: cargo build" "label": "rust: cargo build"
} }
] ]

View File

@ -1,10 +1,8 @@
use std::{ use std::{
collections::HashSet, collections::HashSet,
ffi::{c_char, c_long, c_ulong, c_void, CString}, ptr::null_mut, ffi::{c_char, c_long, c_ulong, c_void, CString},
}; };
use physx_sys::*;
#[allow(dead_code)] #[allow(dead_code)]
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
@ -457,11 +455,21 @@ fn build_test() {
// // println!("lz4 num: {}", num); // // println!("lz4 num: {}", num);
// // } // // }
csbindgen::Builder::default() // csbindgen::Builder::default()
.input_extern_file("csbindgen-tests/src/lib.rs") // .input_extern_file("csbindgen-tests/src/lib.rs")
.csharp_class_name("NativeMethods") // .csharp_class_name("NativeMethods")
.csharp_dll_name("csbindgen_tests") // .csharp_dll_name("csbindgen_tests")
.generate_csharp_file("dotnet-sandbox/NativeMethods.cs") // .generate_csharp_file("dotnet-sandbox/NativeMethods.cs")
// .unwrap();
csbindgen::Builder::new()
.input_bindgen_file("csbindgen-tests/src/physx/physx_generated.rs")
.input_bindgen_file("csbindgen-tests/src/physx/x86_64-pc-windows-msvc/structgen.rs")
.csharp_namespace("Physx")
.csharp_class_name("LibPhysxd")
.csharp_dll_name("libphysx")
.generate_csharp_file("dotnet-sandbox/libphysx_csbindgen.cs")
.unwrap(); .unwrap();
} }
@ -550,31 +558,31 @@ pub struct CallbackTable {
} }
fn run_physix(){ // fn run_physix(){
unsafe { // unsafe {
let foundation = physx_create_foundation(); // let foundation = physx_create_foundation();
let physics = physx_create_physics(foundation); // let physics = physx_create_physics(foundation);
let mut scene_desc = PxSceneDesc_new(PxPhysics_getTolerancesScale(physics)); // let mut scene_desc = PxSceneDesc_new(PxPhysics_getTolerancesScale(physics));
scene_desc.gravity = PxVec3 { // scene_desc.gravity = PxVec3 {
x: 0.0, // x: 0.0,
y: -9.81, // y: -9.81,
z: 0.0, // z: 0.0,
}; // };
let dispatcher = phys_PxDefaultCpuDispatcherCreate( // let dispatcher = phys_PxDefaultCpuDispatcherCreate(
1, // 1,
null_mut(), // null_mut(),
PxDefaultCpuDispatcherWaitForWorkMode::WaitForWork, // PxDefaultCpuDispatcherWaitForWorkMode::WaitForWork,
0, // 0,
); // );
scene_desc.cpuDispatcher = dispatcher.cast(); // scene_desc.cpuDispatcher = dispatcher.cast();
scene_desc.filterShader = get_default_simulation_filter_shader(); // scene_desc.filterShader = get_default_simulation_filter_shader();
let scene = PxPhysics_createScene_mut(physics, &scene_desc); // let scene = PxPhysics_createScene_mut(physics, &scene_desc);
// Your physics simulation goes here // // Your physics simulation goes here
} // }
} // }

View File

@ -16,3 +16,4 @@ repository = "https://github.com/Cysharp/csbindgen/"
[dependencies] [dependencies]
syn = { version = "1.0.109", features = ["full"] } syn = { version = "1.0.109", features = ["full"] }
regex = "1.7.3"

View File

@ -271,6 +271,9 @@ pub fn emit_csharp(
None => "".to_string(), None => "".to_string(),
}; };
let name = &item.enum_name; let name = &item.enum_name;
if item.is_flags {
enum_string.push_str_ln(" [Flags]");
}
enum_string.push_str_ln(format!(" {accessibility} enum {name}{repr}").as_str()); enum_string.push_str_ln(format!(" {accessibility} enum {name}{repr}").as_str());
enum_string.push_str_ln(" {"); enum_string.push_str_ln(" {");
for (name, value) in &item.fields { for (name, value) in &item.fields {
@ -321,6 +324,14 @@ fn convert_token_enum_repr(repr: &str) -> &str {
"(i16)" => "short", "(i16)" => "short",
"(i32)" => "int", "(i32)" => "int",
"(i64)" => "long", "(i64)" => "long",
"u8" => "byte",
"u16" => "ushort",
"u32" => "uint",
"u64" => "ulong",
"i8" => "sbyte",
"i16" => "short",
"i32" => "int",
"i64" => "long",
x => x, x => x,
} }
} }

View File

@ -1,6 +1,7 @@
use crate::{alias_map::AliasMap, builder::BindgenOptions, field_map::FieldMap, type_meta::*}; use crate::{alias_map::AliasMap, builder::BindgenOptions, field_map::FieldMap, type_meta::*};
use std::collections::HashSet; use regex::Regex;
use syn::{ForeignItem, Item, Pat, ReturnType, __private::ToTokens}; use std::{collections::HashSet, fmt::format};
use syn::{ForeignItem, Item, Pat, ReturnType};
enum FnItem { enum FnItem {
ForeignItem(syn::ForeignItemFn), ForeignItem(syn::ForeignItemFn),
@ -207,23 +208,47 @@ pub fn collect_enum(ast: &syn::File, result: &mut Vec<RustEnum>) {
enum_name, enum_name,
fields, fields,
repr, repr,
is_flags: false
}); });
} } else if let Item::Macro(t) = item {
else if let Item::Macro(t) = item {
let last_segment = t.mac.path.segments.last().unwrap(); let last_segment = t.mac.path.segments.last().unwrap();
if last_segment.ident == "bitflags" { if last_segment.ident == "bitflags" {
// t.mac.tokens // bitflags parsing template:
//let inner_ast = syn::parse(t.mac.tokens); // $(#[$outer:meta])*
//let ttt = t.mac.to_token_stream(); // $vis:vis struct $BitFlags:ident: $T:ty {
// $(
// $(#[$inner:ident $($args:tt)*])*
// const $Flag:ident = $value:expr;
// )*
// }
// https://docs.rs/syn/latest/syn/struct.Macro.html let token_string = t.mac.tokens.to_string();
//let foo = t.mac.parse_body().unwrap();
let match1 = Regex::new("pub struct ([^ ]+) : ([^ ]+)")
.unwrap()
.captures(token_string.as_str())
.unwrap();
let enum_name = match1.get(1).unwrap().as_str().to_string();
let repr = Some(match1.get(2).unwrap().as_str().to_string());
let fields = Regex::new("const ([^ ]+) = ([^;]+)[ ]*;")
.unwrap()
.captures_iter(token_string.as_str())
.map(|x| {
(
x.get(1).unwrap().as_str().to_string(),
Some(x.get(2).unwrap().as_str().to_string().replace("Self :: ", "").replace(" . bits", "").trim().to_string()),
)
})
.collect::<Vec<_>>();
result.push(RustEnum {
//let file_ast = syn::parse_file(t.mac.to_tokens(tokens) enum_name,
fields,
repr,
is_flags: true
});
} }
} }
} }

View File

@ -97,6 +97,7 @@ pub struct RustEnum {
pub enum_name: String, pub enum_name: String,
pub fields: Vec<(String, Option<String>)>, // name, value pub fields: Vec<(String, Option<String>)>, // name, value
pub repr: Option<String>, pub repr: Option<String>,
pub is_flags: bool,
} }
impl RustType { impl RustType {

View File

@ -8,11 +8,32 @@ using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
unsafe unsafe
{ {
// $vis:vis struct $BitFlags:ident: $T:ty {
// $(
// $(#[$inner:ident $($args:tt)*])*
// const $Flag:ident = $value:expr;
// )*
// }
var foo = """
[doc = " Flags for [`PxRigidBodyFlag`]"] # [derive (Default)] # [repr (transparent)] pub struct PxRigidBodyFlags : u16 { const Kinematic = 1 << 0 ; const UseKinematicTargetForSceneQueries = 1 << 1; const EnableCcd = 1 << 2 ; const EnableCcdFriction = 1 << 3 ; const EnableSpeculativeCcd = 1 << 4 ; const EnablePoseIntegrationPreview = 1 << 5 ; const EnableCcdMaxContactImpulse = 1 << 6 ; const RetainAccelerations = 1 << 7 ; const ForceKineKineNotifications = 1 << 8 ; const ForceStaticKineNotifications = 1 << 9 ; const EnableGyroscopicForces = 1 << 10 ; }
"""
;
var match1 = Regex.Match(foo, "pub struct ([^ ]+) : ([^ ]+) {");
var enum_name = match1.Groups[1].Value;
var enum_type = match1.Groups[2].Value;
var match2 = Regex.Matches(foo, "const ([^ ]+) = ([^;]+)[ ]*;");
@ -165,25 +186,25 @@ public static unsafe partial class LibraryImportNativeMethods
const string __DllName = "csbindgen_tests"; const string __DllName = "csbindgen_tests";
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })] //[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[LibraryImport(__DllName, EntryPoint = "my_bool")] //[LibraryImport(__DllName, EntryPoint = "my_bool")]
[return: MarshalAs(UnmanagedType.U1)] //[return: MarshalAs(UnmanagedType.U1)]
public static partial bool my_bool([MarshalAs(UnmanagedType.U1)] bool x, [MarshalAs(UnmanagedType.U1)] bool y, [MarshalAs(UnmanagedType.U1)] bool z, bool* xr, bool* yr, bool* zr); //public static partial bool my_bool([MarshalAs(UnmanagedType.U1)] bool x, [MarshalAs(UnmanagedType.U1)] bool y, [MarshalAs(UnmanagedType.U1)] bool z, bool* xr, bool* yr, bool* zr);
//[LibraryImport(__DllName)] ////[LibraryImport(__DllName)]
//public static partial void foo(Foo f); ////public static partial void foo(Foo f);
[LibraryImport(__DllName, EntryPoint = "nullable_callback_test")] //[LibraryImport(__DllName, EntryPoint = "nullable_callback_test")]
public static partial int nullable_callback_test([MarshalAs(UnmanagedType.FunctionPtr)] Func<int, int> cb); //public static partial int nullable_callback_test([MarshalAs(UnmanagedType.FunctionPtr)] Func<int, int> cb);
[LibraryImport(__DllName, EntryPoint = "nullable_callback_test")] //[LibraryImport(__DllName, EntryPoint = "nullable_callback_test")]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })] //[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
public static partial int nullable_callback_test2(delegate* unmanaged[Cdecl]<int, int> cb); //public static partial int nullable_callback_test2(delegate* unmanaged[Cdecl]<int, int> cb);
} }

View File

@ -10171,6 +10171,13 @@ namespace Physx
IsReleasable = 2, IsReleasable = 2,
} }
[Flags]
internal enum PxBaseFlags : ushort
{
OwnsMemory = 1 << 0,
IsReleasable = 1 << 1,
}
internal enum PxTaskType : int internal enum PxTaskType : int
{ {
Cpu = 0, Cpu = 0,
@ -10195,6 +10202,12 @@ namespace Physx
Invalid, Invalid,
} }
[Flags]
internal enum PxGeometryQueryFlags : uint
{
SimdGuard = 1 << 0,
}
internal enum PxBVHBuildStrategy : int internal enum PxBVHBuildStrategy : int
{ {
Fast = 0, Fast = 0,
@ -10203,6 +10216,19 @@ namespace Physx
Last = 3, Last = 3,
} }
[Flags]
internal enum PxConvexMeshGeometryFlags : byte
{
TightBounds = 1 << 0,
}
[Flags]
internal enum PxMeshGeometryFlags : byte
{
TightBounds = 1 << 0,
DoubleSided = 1 << 1,
}
internal enum PxParticleSolverType : int internal enum PxParticleSolverType : int
{ {
Pbd = 1, Pbd = 1,
@ -10211,11 +10237,41 @@ namespace Physx
Custom = 8, Custom = 8,
} }
[Flags]
internal enum PxHitFlags : ushort
{
Position = 1 << 0,
Normal = 1 << 1,
Uv = 1 << 3,
AssumeNoInitialOverlap = 1 << 4,
AnyHit = 1 << 5,
MeshMultiple = 1 << 6,
MeshBothSides = 1 << 7,
PreciseSweep = 1 << 8,
Mtd = 1 << 9,
FaceIndex = 1 << 10,
Default = Position | Normal | FaceIndex,
ModifiableFlags = AssumeNoInitialOverlap | MeshMultiple | MeshBothSides | PreciseSweep,
}
internal enum PxHeightFieldFormat : int internal enum PxHeightFieldFormat : int
{ {
S16Tm = 1, S16Tm = 1,
} }
[Flags]
internal enum PxHeightFieldFlags : ushort
{
NoBoundaryEdges = 1 << 0,
}
[Flags]
internal enum PxMeshFlags : ushort
{
Flipnormals = 1 << 0,
E16BitIndices = 1 << 1,
}
internal enum PxMeshMidPhase : int internal enum PxMeshMidPhase : int
{ {
Bvh33 = 0, Bvh33 = 0,
@ -10223,6 +10279,20 @@ namespace Physx
Last = 2, Last = 2,
} }
[Flags]
internal enum PxTriangleMeshFlags : byte
{
E16BitIndices = 1 << 1,
AdjacencyInfo = 1 << 2,
PreferNoSdfProj = 1 << 3,
}
[Flags]
internal enum PxTetrahedronMeshFlags : byte
{
E16BitIndices = 1 << 1,
}
internal enum PxActorFlag : int internal enum PxActorFlag : int
{ {
Visualization = 1, Visualization = 1,
@ -10231,6 +10301,15 @@ namespace Physx
DisableSimulation = 8, DisableSimulation = 8,
} }
[Flags]
internal enum PxActorFlags : byte
{
Visualization = 1 << 0,
DisableGravity = 1 << 1,
SendSleepNotifies = 1 << 2,
DisableSimulation = 1 << 3,
}
internal enum PxActorType : int internal enum PxActorType : int
{ {
RigidStatic = 0, RigidStatic = 0,
@ -10289,6 +10368,15 @@ namespace Physx
ComputeJointForces = 8, ComputeJointForces = 8,
} }
[Flags]
internal enum PxArticulationFlags : byte
{
FixBase = 1 << 0,
DriveLimitsAreForces = 1 << 1,
DisableSelfCollision = 1 << 2,
ComputeJointForces = 1 << 3,
}
internal enum PxArticulationDriveType : int internal enum PxArticulationDriveType : int
{ {
Force = 0, Force = 0,
@ -10320,6 +10408,22 @@ namespace Physx
SpatialTendonAttachment = 17, SpatialTendonAttachment = 17,
} }
[Flags]
internal enum PxArticulationCacheFlags : uint
{
Velocity = 1 << 0,
Acceleration = 1 << 1,
Position = 1 << 2,
Force = 1 << 3,
LinkVelocity = 1 << 4,
LinkAcceleration = 1 << 5,
RootTransform = 1 << 6,
RootVelocities = 1 << 7,
SensorForces = 1 << 8,
JointSolverForces = 1 << 9,
All = Velocity | Acceleration | Position | LinkVelocity | LinkAcceleration | RootTransform | RootVelocities,
}
internal enum PxArticulationSensorFlag : int internal enum PxArticulationSensorFlag : int
{ {
ForwardDynamicsForces = 1, ForwardDynamicsForces = 1,
@ -10327,6 +10431,21 @@ namespace Physx
WorldFrame = 4, WorldFrame = 4,
} }
[Flags]
internal enum PxArticulationSensorFlags : byte
{
ForwardDynamicsForces = 1 << 0,
ConstraintSolverForces = 1 << 1,
WorldFrame = 1 << 2,
}
[Flags]
internal enum PxArticulationKinematicFlags : byte
{
Position = 1 << 0,
Velocity = 1 << 1,
}
internal enum PxShapeFlag : int internal enum PxShapeFlag : int
{ {
SimulationShape = 1, SimulationShape = 1,
@ -10335,6 +10454,15 @@ namespace Physx
Visualization = 8, Visualization = 8,
} }
[Flags]
internal enum PxShapeFlags : byte
{
SimulationShape = 1 << 0,
SceneQueryShape = 1 << 1,
TriggerShape = 1 << 2,
Visualization = 1 << 3,
}
internal enum PxForceMode : int internal enum PxForceMode : int
{ {
Force = 0, Force = 0,
@ -10358,6 +10486,22 @@ namespace Physx
EnableGyroscopicForces = 1024, EnableGyroscopicForces = 1024,
} }
[Flags]
internal enum PxRigidBodyFlags : ushort
{
Kinematic = 1 << 0,
UseKinematicTargetForSceneQueries = 1 << 1,
EnableCcd = 1 << 2,
EnableCcdFriction = 1 << 3,
EnableSpeculativeCcd = 1 << 4,
EnablePoseIntegrationPreview = 1 << 5,
EnableCcdMaxContactImpulse = 1 << 6,
RetainAccelerations = 1 << 7,
ForceKineKineNotifications = 1 << 8,
ForceStaticKineNotifications = 1 << 9,
EnableGyroscopicForces = 1 << 10,
}
internal enum PxConstraintFlag : int internal enum PxConstraintFlag : int
{ {
Broken = 1, Broken = 1,
@ -10375,6 +10519,24 @@ namespace Physx
DisableConstraint = 4096, DisableConstraint = 4096,
} }
[Flags]
internal enum PxConstraintFlags : ushort
{
Broken = 1 << 0,
ProjectToActor0 = 1 << 1,
ProjectToActor1 = 1 << 2,
Projection = ProjectToActor0 | ProjectToActor1,
CollisionEnabled = 1 << 3,
Visualization = 1 << 4,
DriveLimitsAreForces = 1 << 5,
ImprovedSlerp = 1 << 7,
DisablePreprocessing = 1 << 8,
EnableExtendedLimits = 1 << 9,
GpuCompatible = 1 << 10,
AlwaysUpdate = 1 << 11,
DisableConstraint = 1 << 12,
}
internal enum StreamFormat : int internal enum StreamFormat : int
{ {
SimpleStream = 0, SimpleStream = 0,
@ -10388,6 +10550,13 @@ namespace Physx
MemoryRelease = 2, MemoryRelease = 2,
} }
[Flags]
internal enum PxDeletionEventFlags : byte
{
UserRelease = 1 << 0,
MemoryRelease = 1 << 1,
}
internal enum PxPairFlag : int internal enum PxPairFlag : int
{ {
SolveContact = 1, SolveContact = 1,
@ -10410,6 +10579,38 @@ namespace Physx
TriggerDefault = 1044, TriggerDefault = 1044,
} }
[Flags]
internal enum PxPairFlags : ushort
{
SolveContact = 1 << 0,
ModifyContacts = 1 << 1,
NotifyTouchFound = 1 << 2,
NotifyTouchPersists = 1 << 3,
NotifyTouchLost = 1 << 4,
NotifyTouchCcd = 1 << 5,
NotifyThresholdForceFound = 1 << 6,
NotifyThresholdForcePersists = 1 << 7,
NotifyThresholdForceLost = 1 << 8,
NotifyContactPoints = 1 << 9,
DetectDiscreteContact = 1 << 10,
DetectCcdContact = 1 << 11,
PreSolverVelocity = 1 << 12,
PostSolverVelocity = 1 << 13,
ContactEventPose = 1 << 14,
NextFree = 1 << 15,
ContactDefault = SolveContact | DetectDiscreteContact,
TriggerDefault = NotifyTouchFound | NotifyTouchLost | DetectDiscreteContact,
}
[Flags]
internal enum PxFilterFlags : ushort
{
Kill = 1 << 0,
Suppress = 1 << 1,
Callback = 1 << 2,
Notify = Callback,
}
internal enum PxFilterObjectType : int internal enum PxFilterObjectType : int
{ {
RigidStatic = 0, RigidStatic = 0,
@ -10430,6 +10631,14 @@ namespace Physx
Kill = 2, Kill = 2,
} }
[Flags]
internal enum PxDataAccessFlags : byte
{
Readable = 1 << 0,
Writable = 1 << 1,
Device = 1 << 2,
}
internal enum PxMaterialFlag : int internal enum PxMaterialFlag : int
{ {
DisableFriction = 1, DisableFriction = 1,
@ -10438,6 +10647,15 @@ namespace Physx
CompliantContact = 8, CompliantContact = 8,
} }
[Flags]
internal enum PxMaterialFlags : ushort
{
DisableFriction = 1 << 0,
DisableStrongFriction = 1 << 1,
ImprovedPatchFriction = 1 << 2,
CompliantContact = 1 << 3,
}
internal enum PxCombineMode : int internal enum PxCombineMode : int
{ {
Average = 0, Average = 0,
@ -10448,6 +10666,33 @@ namespace Physx
Pad32 = 2147483647, Pad32 = 2147483647,
} }
[Flags]
internal enum PxParticleBufferFlags : uint
{
UpdatePosition = 1 << 0,
UpdateVelocity = 1 << 1,
UpdatePhase = 1 << 2,
UpdateRestposition = 1 << 3,
UpdateCloth = 1 << 5,
UpdateRigid = 1 << 6,
UpdateDiffuseParam = 1 << 7,
UpdateAttachments = 1 << 8,
All = UpdatePosition | UpdateVelocity | UpdatePhase | UpdateRestposition | UpdateCloth | UpdateRigid | UpdateDiffuseParam | UpdateAttachments,
}
[Flags]
internal enum PxQueryFlags : ushort
{
Static = 1 << 0,
Dynamic = 1 << 1,
Prefilter = 1 << 2,
Postfilter = 1 << 3,
AnyHit = 1 << 4,
NoBlock = 1 << 5,
DisableHardcodedFilter = 1 << 6,
Reserved = 1 << 15,
}
internal enum PxQueryHitType : int internal enum PxQueryHitType : int
{ {
None = 0, None = 0,
@ -10465,6 +10710,17 @@ namespace Physx
LockAngularZ = 32, LockAngularZ = 32,
} }
[Flags]
internal enum PxRigidDynamicLockFlags : byte
{
LockLinearX = 1 << 0,
LockLinearY = 1 << 1,
LockLinearZ = 1 << 2,
LockAngularX = 1 << 3,
LockAngularY = 1 << 4,
LockAngularZ = 1 << 5,
}
internal enum PxPruningStructureType : int internal enum PxPruningStructureType : int
{ {
None = 0, None = 0,
@ -10533,6 +10789,27 @@ namespace Physx
MutableFlags = 69633, MutableFlags = 69633,
} }
[Flags]
internal enum PxSceneFlags : uint
{
EnableActiveActors = 1 << 0,
EnableCcd = 1 << 1,
DisableCcdResweep = 1 << 2,
EnablePcm = 1 << 6,
DisableContactReportBufferResize = 1 << 7,
DisableContactCache = 1 << 8,
RequireRwLock = 1 << 9,
EnableStabilization = 1 << 10,
EnableAveragePoint = 1 << 11,
ExcludeKinematicsFromActiveActors = 1 << 12,
EnableGpuDynamics = 1 << 13,
EnableEnhancedDeterminism = 1 << 14,
EnableFrictionEveryIteration = 1 << 15,
SuppressReadback = 1 << 16,
ForceReadback = 1 << 17,
MutableFlags = EnableActiveActors | ExcludeKinematicsFromActiveActors | SuppressReadback,
}
internal enum PxVisualizationParameter : int internal enum PxVisualizationParameter : int
{ {
Scale = 0, Scale = 0,
@ -10600,6 +10877,47 @@ namespace Physx
TransmitConstraints = 4, TransmitConstraints = 4,
} }
[Flags]
internal enum PxPvdSceneFlags : byte
{
TransmitContacts = 1 << 0,
TransmitScenequeries = 1 << 1,
TransmitConstraints = 1 << 2,
}
[Flags]
internal enum PxActorTypeFlags : ushort
{
RigidStatic = 1 << 0,
RigidDynamic = 1 << 1,
}
[Flags]
internal enum PxContactPairHeaderFlags : ushort
{
RemovedActor0 = 1 << 0,
RemovedActor1 = 1 << 1,
}
[Flags]
internal enum PxContactPairFlags : ushort
{
RemovedShape0 = 1 << 0,
RemovedShape1 = 1 << 1,
ActorPairHasFirstTouch = 1 << 2,
ActorPairLostTouch = 1 << 3,
InternalHasImpulses = 1 << 4,
InternalContactsAreFlipped = 1 << 5,
}
[Flags]
internal enum PxTriggerPairFlags : byte
{
RemovedShapeTrigger = 1 << 0,
RemovedShapeOther = 1 << 1,
NextFree = 1 << 2,
}
internal enum PxControllerShapeType : int internal enum PxControllerShapeType : int
{ {
Box = 0, Box = 0,
@ -10613,6 +10931,14 @@ namespace Physx
PreventClimbingAndForceSliding = 1, PreventClimbingAndForceSliding = 1,
} }
[Flags]
internal enum PxControllerCollisionFlags : byte
{
CollisionSides = 1 << 0,
CollisionUp = 1 << 1,
CollisionDown = 1 << 2,
}
internal enum PxCapsuleClimbingMode : int internal enum PxCapsuleClimbingMode : int
{ {
Easy = 0, Easy = 0,
@ -10620,6 +10946,23 @@ namespace Physx
Last = 2, Last = 2,
} }
[Flags]
internal enum PxControllerBehaviorFlags : byte
{
CctCanRideOnObject = 1 << 0,
CctSlide = 1 << 1,
CctUserDefinedRide = 1 << 2,
}
[Flags]
internal enum PxControllerDebugRenderFlags : uint
{
TemporalBv = 1 << 0,
CachedBv = 1 << 1,
Obstacles = 1 << 2,
All = TemporalBv | CachedBv | Obstacles,
}
internal enum PxSdfBitsPerSubgridPixel : int internal enum PxSdfBitsPerSubgridPixel : int
{ {
E8BitPerPixel = 1, E8BitPerPixel = 1,
@ -10627,6 +10970,20 @@ namespace Physx
E32BitPerPixel = 4, E32BitPerPixel = 4,
} }
[Flags]
internal enum PxConvexFlags : ushort
{
E16BitIndices = 1 << 0,
ComputeConvex = 1 << 1,
CheckZeroAreaTriangles = 1 << 2,
QuantizeInput = 1 << 3,
DisableMeshValidation = 1 << 4,
PlaneShifting = 1 << 5,
FastInertiaComputation = 1 << 6,
GpuCompatible = 1 << 7,
ShiftVertices = 1 << 8,
}
internal enum PxBVH34BuildStrategy : int internal enum PxBVH34BuildStrategy : int
{ {
Fast = 0, Fast = 0,
@ -10655,6 +11012,17 @@ namespace Physx
Failure = 2, Failure = 2,
} }
[Flags]
internal enum PxMeshPreprocessingFlags : uint
{
WeldVertices = 1 << 0,
DisableCleanMesh = 1 << 1,
DisableActiveEdgesPrecompute = 1 << 2,
Force32bitIndices = 1 << 3,
EnableVertMapping = 1 << 4,
EnableInertia = 1 << 5,
}
internal enum PxJointActorIndex : int internal enum PxJointActorIndex : int
{ {
Actor0 = 0, Actor0 = 0,
@ -10669,11 +11037,25 @@ namespace Physx
SpringEnabled = 8, SpringEnabled = 8,
} }
[Flags]
internal enum PxDistanceJointFlags : ushort
{
MaxDistanceEnabled = 1 << 1,
MinDistanceEnabled = 1 << 2,
SpringEnabled = 1 << 3,
}
internal enum PxPrismaticJointFlag : int internal enum PxPrismaticJointFlag : int
{ {
LimitEnabled = 2, LimitEnabled = 2,
} }
[Flags]
internal enum PxPrismaticJointFlags : ushort
{
LimitEnabled = 1 << 1,
}
internal enum PxRevoluteJointFlag : int internal enum PxRevoluteJointFlag : int
{ {
LimitEnabled = 1, LimitEnabled = 1,
@ -10681,11 +11063,25 @@ namespace Physx
DriveFreespin = 4, DriveFreespin = 4,
} }
[Flags]
internal enum PxRevoluteJointFlags : ushort
{
LimitEnabled = 1 << 0,
DriveEnabled = 1 << 1,
DriveFreespin = 1 << 2,
}
internal enum PxSphericalJointFlag : int internal enum PxSphericalJointFlag : int
{ {
LimitEnabled = 2, LimitEnabled = 2,
} }
[Flags]
internal enum PxSphericalJointFlags : ushort
{
LimitEnabled = 1 << 1,
}
internal enum PxD6Axis : int internal enum PxD6Axis : int
{ {
X = 0, X = 0,
@ -10715,6 +11111,12 @@ namespace Physx
Count = 6, Count = 6,
} }
[Flags]
internal enum PxD6JointDriveFlags : uint
{
Acceleration = 1 << 0,
}
internal enum PxFilterOp : int internal enum PxFilterOp : int
{ {
PxFilteropAnd = 0, PxFilteropAnd = 0,
@ -10733,6 +11135,15 @@ namespace Physx
YieldProcessor = 2, YieldProcessor = 2,
} }
[Flags]
internal enum PxPvdInstrumentationFlags : byte
{
Debug = 1 << 0,
Profile = 1 << 1,
Memory = 1 << 2,
All = Debug | Profile | Memory,
}
} }